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