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

source code of lldb/test/API/functionalities/lazy-loading/main.cpp