1// Compile with "cl /c /Zi /GR- /EHsc test-pdb-types.cpp"
2// Link with "link test-pdb-types.obj /debug /nodefaultlib /entry:main
3// /out:test-pdb-types.exe"
4
5// Sizes of builtin types
6static const int sizeof_char = sizeof(char);
7static const int sizeof_uchar = sizeof(unsigned char);
8static const int sizeof_short = sizeof(short);
9static const int sizeof_ushort = sizeof(unsigned short);
10static const int sizeof_int = sizeof(int);
11static const int sizeof_uint = sizeof(unsigned int);
12static const int sizeof_long = sizeof(long);
13static const int sizeof_ulong = sizeof(unsigned long);
14static const int sizeof_longlong = sizeof(long long);
15static const int sizeof_ulonglong = sizeof(unsigned long long);
16static const int sizeof_int64 = sizeof(__int64);
17static const int sizeof_uint64 = sizeof(unsigned __int64);
18static const int sizeof_float = sizeof(float);
19static const int sizeof_double = sizeof(double);
20static const int sizeof_bool = sizeof(bool);
21static const int sizeof_wchar = sizeof(wchar_t);
22
23enum Enum {
24 EValue1 = 1,
25 EValue2 = 2,
26};
27
28enum ShortEnum : short { ESValue1 = 1, ESValue2 = 2 };
29
30namespace NS {
31class NSClass {
32 float f;
33 double d;
34};
35} // namespace NS
36
37class Class {
38public:
39 class NestedClass {
40 Enum e;
41 };
42 ShortEnum se;
43};
44
45int test_func(int a, int b) { return a + b; }
46
47typedef Class ClassTypedef;
48typedef NS::NSClass NSClassTypedef;
49typedef int (*FuncPointerTypedef)();
50typedef int (*VariadicFuncPointerTypedef)(char, ...);
51FuncPointerTypedef GlobalFunc;
52VariadicFuncPointerTypedef GlobalVariadicFunc;
53int GlobalArray[10];
54
55static const int sizeof_NSClass = sizeof(NS::NSClass);
56static const int sizeof_Class = sizeof(Class);
57static const int sizeof_NestedClass = sizeof(Class::NestedClass);
58static const int sizeof_Enum = sizeof(Enum);
59static const int sizeof_ShortEnum = sizeof(ShortEnum);
60static const int sizeof_ClassTypedef = sizeof(ClassTypedef);
61static const int sizeof_NSClassTypedef = sizeof(NSClassTypedef);
62static const int sizeof_FuncPointerTypedef = sizeof(FuncPointerTypedef);
63static const int sizeof_VariadicFuncPointerTypedef =
64 sizeof(VariadicFuncPointerTypedef);
65static const int sizeof_GlobalArray = sizeof(GlobalArray);
66
67int main(int argc, char **argv) {
68 ShortEnum e1;
69 Enum e2;
70 Class c1;
71 Class::NestedClass c2;
72 NS::NSClass c3;
73
74 ClassTypedef t1;
75 NSClassTypedef t2;
76 return test_func(a: 1, b: 2);
77}
78

source code of lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp