51 lines · cpp
1typedef int IntTypedef;2IntTypedef g_IntVar; // Testing globals.3 4typedef enum Enum { // Testing constants.5 RED,6 GREEN,7 BLUE8} EnumTypedef;9EnumTypedef g_EnumVar; // Testing members.10 11// FIXME: `sg_IntVar` appears both in global scope's children and compiland's12// children but with different symbol's id.13static int sg_IntVar = -1; // Testing file statics.14 15// FIXME: `g_Const` appears both in global scope's children and compiland's16// children but with different symbol's id.17const int g_Const = 0x88; // Testing constant data.18const int *g_pConst = &g_Const; // Avoid optimizing the const away19 20thread_local int g_tls = 0; // Testing thread-local storage.21 22class Class {23 static int m_StaticClassMember;24public:25 explicit Class(int a) {}26 void Func() {}27};28int Class::m_StaticClassMember = 10; // Testing static class members.29Class ClassVar(1);30 31int f(int var_arg1, int var_arg2) { // Testing parameters.32 long same_name_var = -1;33 return 1;34}35 36int same_name_var = 100;37int 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 away44 45 int a = 10;46 a++;47 48 ClassVar.Func();49 return 0;50}51