1 //----------------------------------------------------------------------------//
2 // Struct loading declarations.
3 
4 struct StructFirstMember { int i; };
5 struct StructBehindPointer { int i; };
6 struct StructBehindRef { int i; };
7 struct StructMember { int i; };
8 
9 StructBehindRef struct_instance;
10 
11 struct SomeStruct {
12   StructFirstMember *first;
13   StructBehindPointer *ptr;
14   StructMember member;
15   StructBehindRef &ref = struct_instance;
16 };
17 
18 struct OtherStruct {
19   int member_int;
20 };
21 
22 //----------------------------------------------------------------------------//
23 // Class loading declarations.
24 
25 struct ClassMember { int i; };
26 struct StaticClassMember { int i; };
27 struct UnusedClassMember { int i; };
28 struct UnusedClassMemberPtr { int i; };
29 struct PointerToMember { int i; };
30 
31 namespace NS {
32 class ClassInNamespace {
33   int i;
34 };
35 class ClassWeEnter {
36 public:
37   int dummy; // Prevent bug where LLDB always completes first member.
38   ClassMember member;
39   static StaticClassMember static_member;
40   int (PointerToMember::*ptr_to_member);
41   UnusedClassMember unused_member;
42   UnusedClassMemberPtr *unused_member_ptr;
43   int enteredFunction() {
44     return member.i; // Location: class function
45   }
46 };
47 StaticClassMember ClassWeEnter::static_member;
48 };
49 
50 //----------------------------------------------------------------------------//
51 // Function we can stop in.
52 
53 int functionWithOtherStruct() {
54   OtherStruct other_struct_var;
55   other_struct_var.member_int++; // Location: other struct function
56   return other_struct_var.member_int;
57 }
58 
59 int functionWithMultipleLocals() {
60   SomeStruct struct_var;
61   OtherStruct other_struct_var;
62   NS::ClassInNamespace namespace_class;
63   other_struct_var.member_int++; // Location: multiple locals function
64   return other_struct_var.member_int;
65 }
66 
67 int main(int argc, char **argv) {
68   NS::ClassWeEnter c;
69   c.enteredFunction();
70 
71   functionWithOtherStruct();
72   functionWithMultipleLocals();
73   return 0;
74 }
75