xref: /llvm-project/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp (revision 3abd063fc793d2d56fc78287c61b73b2d7843bc5)
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4 
5 struct i_am_cool
6 {
7 	int integer;
8 	float floating;
9 	char character;
10 	i_am_cool(int I, float F, char C) :
11     integer(I), floating(F), character(C) {}
12 	i_am_cool() : integer(1), floating(2), character('3') {}
13 
14 };
15 
16 struct i_am_cooler
17 {
18 	i_am_cool first_cool;
19 	i_am_cool second_cool;
20 	float floating;
21 
22 	i_am_cooler(int I1, int I2, float F1, float F2, char C1, char C2) :
23     first_cool(I1,F1,C1),
24     second_cool(I2,F2,C2),
25     floating((F1 + F2)/2) {}
26 };
27 
28 struct IWrapPointers
29 {
30     int* int_pointer;
31     float* float_pointer;
32 	IWrapPointers() : int_pointer(new int(4)), float_pointer(new float(1.111)) {}
33 };
34 
35 struct Simple
36 {
37 	int x;
38 	float y;
39 	char z;
40 	Simple(int X, float Y, char Z) :
41 	x(X),
42 	y(Y),
43 	z(Z)
44 	{}
45 };
46 
47 struct SimpleWithPointers
48 {
49 	int *x;
50 	float *y;
51 	char *z;
52 	SimpleWithPointers(int X, float Y, char Z) :
53 	x(new int (X)),
54 	y(new float (Y)),
55 	z(new char[2])
56 	{
57           z[0] = Z;
58           z[1] = '\0';
59         }
60 };
61 
62 struct Couple
63 {
64 	SimpleWithPointers sp;
65 	Simple* s;
66 	Couple(int X, float Y, char Z) : sp(X,Y,Z),
67 	s(new Simple(X,Y,Z)) {}
68 };
69 
70 struct VeryLong
71 {
72     int a_1;
73     int b_1;
74     int c_1;
75     int d_1;
76     int e_1;
77     int f_1;
78     int g_1;
79     int h_1;
80     int i_1;
81     int j_1;
82     int k_1;
83     int l_1;
84     int m_1;
85     int n_1;
86     int o_1;
87     int p_1;
88     int q_1;
89     int r_1;
90     int s_1;
91     int t_1;
92     int u_1;
93     int v_1;
94     int w_1;
95     int x_1;
96     int y_1;
97     int z_1;
98 
99     int a_2;
100     int b_2;
101     int c_2;
102     int d_2;
103     int e_2;
104     int f_2;
105     int g_2;
106     int h_2;
107     int i_2;
108     int j_2;
109     int k_2;
110     int l_2;
111     int m_2;
112     int n_2;
113     int o_2;
114     int p_2;
115     int q_2;
116     int r_2;
117     int s_2;
118     int t_2;
119     int u_2;
120     int v_2;
121     int w_2;
122     int x_2;
123     int y_2;
124     int z_2;
125 };
126 
127 int main (int argc, const char * argv[])
128 {
129 
130     int iAmInt = 9;
131     const int constInt = 42;
132     volatile int volatileInt = 43;
133     const volatile int constVolatileInt = 44;
134 
135     i_am_cool cool_boy(1,0.5,3);
136     i_am_cooler cooler_boy(1,2,0.1,0.2,'A','B');
137 
138 	i_am_cool *cool_pointer = new i_am_cool(3,-3.141592,'E');
139 
140     i_am_cool cool_array[5];
141 
142     cool_array[3].floating = 5.25;
143     cool_array[4].integer = 6;
144     cool_array[2].character = 'Q';
145 
146     int int_array[] = {1,2,3,4,5};
147     const int const_int_array[] = {11, 12, 13, 14, 15};
148 
149     IWrapPointers wrapper;
150 
151     *int_array = -1;
152 
153     int* pointer = &cool_array[4].integer;
154 
155     IWrapPointers *wrap_pointer = &wrapper;
156 
157     Couple couple(9,9.99,'X');
158 
159 	SimpleWithPointers sparray[] =
160         {SimpleWithPointers(-1,-2,'3'),
161         SimpleWithPointers(-4,-5,'6'),
162         SimpleWithPointers(-7,-8,'9')};
163 
164     Simple a_simple_object(3,0.14,'E');
165 
166     VeryLong a_long_guy;
167 
168     return 0; // Set break point at this line.
169 }
170