Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / functionalities / lazy-loading / main.cpp
blobbb8f56e277cedba52d83a3f0612e9db5ca2e0f2c
1 //----------------------------------------------------------------------------//
2 // Struct loading declarations.
4 struct StructFirstMember { int i; };
5 struct StructBehindPointer { int i; };
6 struct StructBehindRef { int i; };
7 struct StructMember { int i; };
9 StructBehindRef struct_instance;
11 struct SomeStruct {
12 StructFirstMember *first;
13 StructBehindPointer *ptr;
14 StructMember member;
15 StructBehindRef &ref = struct_instance;
18 struct OtherStruct {
19 int member_int;
22 //----------------------------------------------------------------------------//
23 // Class loading declarations.
25 struct ClassMember { int i; };
26 struct StaticClassMember { int i; };
27 struct UnusedClassMember { int i; };
28 struct UnusedClassMemberPtr { int i; };
30 namespace NS {
31 class ClassInNamespace {
32 int i;
34 class ClassWeEnter {
35 public:
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
45 StaticClassMember ClassWeEnter::static_member;
48 //----------------------------------------------------------------------------//
49 // Function we can stop in.
51 int functionWithOtherStruct() {
52 OtherStruct other_struct_var;
53 other_struct_var.member_int++; // Location: other struct function
54 return other_struct_var.member_int;
57 int 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;
65 int main(int argc, char **argv) {
66 NS::ClassWeEnter c;
67 c.enteredFunction();
69 functionWithOtherStruct();
70 functionWithMultipleLocals();
71 return 0;