xref: /llvm-project/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesTest.cpp (revision 87aa9c9e4d41ed881453e2fab85b3d25f648bb55)
1 typedef int IntTypedef;
2 IntTypedef g_IntVar;  // Testing globals.
3 
4 typedef enum Enum { // Testing constants.
5   RED,
6   GREEN,
7   BLUE
8 } EnumTypedef;
9 EnumTypedef g_EnumVar;  // Testing members.
10 
11 // FIXME: `sg_IntVar` appears both in global scope's children and compiland's
12 // children but with different symbol's id.
13 static int sg_IntVar = -1;  // Testing file statics.
14 
15 // FIXME: `g_Const` appears both in global scope's children and compiland's
16 // children but with different symbol's id.
17 const int g_Const = 0x88;  // Testing constant data.
18 const int *g_pConst = &g_Const; // Avoid optimizing the const away
19 
20 thread_local int g_tls = 0;  // Testing thread-local storage.
21 
22 class Class {
23   static int m_StaticClassMember;
24 public:
Class(int a)25   explicit Class(int a) {}
Func()26   void Func() {}
27 };
28 int Class::m_StaticClassMember = 10; // Testing static class members.
29 Class ClassVar(1);
30 
f(int var_arg1,int var_arg2)31 int f(int var_arg1, int var_arg2) {  // Testing parameters.
32   long same_name_var = -1;
33   return 1;
34 }
35 
36 int same_name_var = 100;
main()37 int main() {
38   int same_name_var = 0;  // Testing locals.
39   const char local_const = 0x1;
40 
41   // FIXME: 'local_CString` is not found through compiland's children.
42   const char local_CString[] = "abc";  // Testing constant string.
43   const char *local_pCString = local_CString; // Avoid optimizing the const away
44 
45   int a = 10;
46   a++;
47 
48   ClassVar.Func();
49   return 0;
50 }
51