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 UnusedClassMember { int i; };
27 struct UnusedClassMemberPtr { int i; };
28 
29 namespace NS {
30 class ClassInNamespace {
31   int i;
32 };
33 class ClassWeEnter {
34 public:
35   int dummy; // Prevent bug where LLDB always completes first member.
36   ClassMember member;
37   UnusedClassMember unused_member;
38   UnusedClassMemberPtr *unused_member_ptr;
enteredFunction()39   int enteredFunction() {
40     return member.i; // Location: class function
41   }
42 };
43 };
44 
45 //----------------------------------------------------------------------------//
46 // Function we can stop in.
47 
functionWithOtherStruct()48 int functionWithOtherStruct() {
49   OtherStruct other_struct_var;
50   other_struct_var.member_int++; // Location: other struct function
51   return other_struct_var.member_int;
52 }
53 
functionWithMultipleLocals()54 int functionWithMultipleLocals() {
55   SomeStruct struct_var;
56   OtherStruct other_struct_var;
57   NS::ClassInNamespace namespace_class;
58   other_struct_var.member_int++; // Location: multiple locals function
59   return other_struct_var.member_int;
60 }
61 
main(int argc,char ** argv)62 int main(int argc, char **argv) {
63   NS::ClassWeEnter c;
64   c.enteredFunction();
65 
66   functionWithOtherStruct();
67   functionWithMultipleLocals();
68   return 0;
69 }
70