xref: /llvm-project/llvm/test/DebugInfo/PDB/Inputs/every-type.cpp (revision a98ee586bf6f396b2b6a7deeef24db87bb6736b2)
1 // Build with "cl.exe /Zi /GR- /GX- every-type.cpp /link /debug /nodefaultlib /entry:main"
2 
3 // clang-format off
4 void *__purecall = 0;
5 
operator delete(void *,unsigned int)6 void __cdecl operator delete(void *,unsigned int) {}
operator delete(void *,unsigned __int64)7 void __cdecl operator delete(void *,unsigned __int64) {}
8 
9 struct FooStruct { };                      // LF_STRUCTURE
10 
11 class FooClass {                           // LF_CLASS
12 public:
13                                            // LF_FIELDLIST
14   enum NestedEnum {                        // LF_ENUM
15                                            // LF_NESTTYPE
16     A, B, C                                // LF_ENUMERATE
17   };
18 
RegularMethod()19   void RegularMethod() {}                  // LF_ARGLIST
20                                            // LF_ONEMETHOD
21                                            // LF_MFUNCTION
22 
OverloadedMethod(int)23   void OverloadedMethod(int) {}            // LF_METHODLIST
24                                            // LF_METHOD
OverloadedMethod(int,int)25   void OverloadedMethod(int, int) {}
26 
27   int HiNibble : 4;                        // LF_BITFIELD
28   int LoNibble : 4;
29   NestedEnum EnumVariable;                 // LF_MEMBER
30   static void *StaticMember;               // LF_POINTER
31                                            // LF_STMEMBER
32 };
33 
34 void *FooClass::StaticMember = nullptr;
35 
36 class Inherit : public FooClass {           // LF_BCLASS
37 public:
~Inherit()38   virtual ~Inherit() {}                     // LF_VTSHAPE
39                                             // LF_VFUNCTAB
40 };
41 
42 class VInherit : public virtual FooClass {  // LF_VBCLASS
43 
44 };
45 
46 class IVInherit : public VInherit {         // LF_IVBCLASS
47 };
48 
49 union TheUnion {
50   int X;                                    // LF_UNION
51 };
52 
53 int SomeArray[7] = {1, 2, 3, 4, 5, 6, 7};   // LF_ARRAY
54 
55 template<typename T>
Reference(T & t)56 void Reference(T &t) { }
57 
58 const volatile FooStruct FS;             // LF_MODIFIER with struct
59 const volatile FooClass FC;              // LF_MODIFIER with class
60 const volatile TheUnion TU;              // LF_MODIFIER with union
61 const volatile FooClass::NestedEnum FCNE = FooClass::A;  // LF_MODIFIER with enum
62 
63 
main(int argc,char ** argv)64 int main(int argc, char **argv) {           // LF_PROCEDURE
65   const int X = 7;                          // LF_MODIFIER
66 
67   FooStruct FooStructInstance;
68   FooClass FooClassInstance;
69   Inherit InheritInstance;
70   VInherit VInheritInstance;
71   IVInherit IVInheritInstance;
72   TheUnion UnionInstance;
73   Reference(FS);             // LF_MODIFIER with struct
74   Reference(FC);              // LF_MODIFIER with class
75   Reference(TU);              // LF_MODIFIER with union
76   Reference(FCNE);  // LF_MODIFIER with enum
77   return SomeArray[argc];
78 }
79