1class MyClass
2{
3public:
4 int memberResult()
5 {
6 return 1;
7 }
8 static int staticResult()
9 {
10 return 1;
11 }
12 int externResult();
13};
14
15// --
16
17int MyClass::externResult()
18{
19 return 1;
20}
21
22// --
23
24MyClass m;
25
26// --
27
28enum MyEnum {
29 myEnumOne = 1,
30 myEnumTwo,
31 myEnumThree
32};
33
34// --
35
36class AnotherClass
37{
38public:
39 __attribute__ ((always_inline)) int complicatedFunction()
40 {
41 struct {
42 int i;
43 } s = { .i: 15 };
44
45 int numbers[4] = { 2, 3, 4, 5 };
46
47 for (signed char number: numbers)
48 {
49 s.i -= number;
50 }
51
52 return s.i;
53 }
54};
55
56// --
57
58class DiamondA
59{
60private:
61 struct {
62 int m_i;
63 };
64public:
65 DiamondA(int i) : m_i(i) { }
66 int accessor() { return m_i; }
67};
68
69// --
70
71class DiamondB : public virtual DiamondA
72{
73public:
74 DiamondB(int i) : DiamondA(i) { }
75};
76
77// --
78
79class DiamondC : public virtual DiamondA
80{
81public:
82 DiamondC(int i) : DiamondA(i) { }
83};
84
85// --
86
87class DiamondD : public DiamondB, public DiamondC
88{
89public:
90 DiamondD(int i) : DiamondA(i), DiamondB(i), DiamondC(i) { }
91};
92
93// --
94
95int doTest()
96{
97 int accumulator = m.memberResult();
98 accumulator += MyClass::staticResult();
99 accumulator += m.externResult();
100 accumulator += MyEnum::myEnumThree;
101 accumulator += myEnumOne;
102 accumulator += AnotherClass().complicatedFunction();
103 accumulator += DiamondD(3).accessor();
104 return accumulator;
105}
106
107// --
108

source code of lldb/test/API/commands/expression/top-level/test.cpp