xref: /llvm-project/lldb/test/API/commands/expression/context-object/main.cpp (revision 99451b4453688a94c6014cac233d371ab4cc342d)
1 namespace cpp_namespace {
2   struct CppStruct {
3     int field = 1111;
4 
5     int function() {
6       return 2222;
7     }
8   };
9 
10   union CppUnion {
11     char field_char;
12     short field_short;
13     int field_int;
14   };
15 
16   CppStruct GetCppStruct() {
17     return CppStruct();
18   }
19 
20   CppStruct global;
21 
22   CppStruct *GetCppStructPtr() {
23     return &global;
24   }
25 }
26 
27 int global = 3333;
28 
29 int main()
30 {
31   cpp_namespace::CppStruct cpp_struct = cpp_namespace::GetCppStruct();
32   cpp_struct.function();
33 
34   int field = 4444;
35 
36   cpp_namespace::CppUnion cpp_union;
37   cpp_union.field_int = 5555;
38 
39   int cpp_scalar = 6666;
40 
41   cpp_namespace::CppStruct cpp_array[16];
42 
43   cpp_namespace::CppStruct *cpp_pointer = cpp_namespace::GetCppStructPtr();
44 
45   return 0; // Break here
46 }
47