1#include <stdio.h>
2#include <stdlib.h>
3#include <stdint.h>
4
5typedef float RealNumber; // should show as char
6typedef RealNumber Temperature; // should show as float
7typedef RealNumber Speed; // should show as hex
8
9typedef int Counter; // should show as int
10typedef int BitField; // should show as hex
11
12typedef BitField SignalMask; // should show as hex
13typedef BitField Modifiers; // should show as hex
14
15typedef Counter Accumulator; // should show as int
16
17typedef int Type1; // should show as char
18typedef Type1 Type2; // should show as hex
19typedef Type2 Type3; // should show as char
20typedef Type3 Type4; // should show as char
21
22typedef int ChildType; // should show as int
23typedef int AnotherChildType; // should show as int
24
25struct TestPoint {
26 int x;
27 int y;
28 TestPoint(int X = 3, int Y = 2) : x(X), y(Y) {}
29};
30
31typedef float ShowMyGuts;
32
33struct i_am_cool
34{
35 int integer;
36 ShowMyGuts floating;
37 char character;
38 i_am_cool(int I, ShowMyGuts F, char C) :
39 integer(I), floating(F), character(C) {}
40 i_am_cool() : integer(1), floating(2), character('3') {}
41
42};
43
44struct i_am_cooler
45{
46 i_am_cool first_cool;
47 i_am_cool second_cool;
48 ShowMyGuts floating;
49
50 i_am_cooler(int I1, int I2, float F1, float F2, char C1, char C2) :
51 first_cool(I1,F1,C1),
52 second_cool(I2,F2,C2),
53 floating((F1 + F2)/2) {}
54};
55
56struct IUseCharStar
57{
58 const char* pointer;
59 IUseCharStar() : pointer("Hello world") {}
60
61 char const *member_func(int) { return ""; }
62 virtual void virt_member_func() {}
63};
64
65void has_local_mem_func_pointers() {
66 const char *IUseCharStar::*member_ptr = &IUseCharStar::pointer;
67 const char *(IUseCharStar::*member_func_ptr)(int) =
68 &IUseCharStar::member_func;
69 auto &ref_to_member_func_ptr = member_func_ptr;
70
71 void (IUseCharStar::*virt_member_func_ptr)() =
72 &IUseCharStar::virt_member_func;
73
74 ::puts(s: "Break in has_local_mem_func_pointers");
75}
76
77int main (int argc, const char * argv[])
78{
79
80 int iAmInt = 1;
81 const float& IAmFloat = float(2.45);
82
83 RealNumber RNILookChar = 3.14;
84 Temperature TMILookFloat = 4.97;
85 Speed SPILookHex = 5.55;
86
87 Counter CTILookInt = 6;
88 BitField BFILookHex = 7;
89 SignalMask SMILookHex = 8;
90 Modifiers MFILookHex = 9;
91
92 Accumulator* ACILookInt = new Accumulator(10);
93
94 const Type1& T1ILookChar = 11;
95 Type2 T2ILookHex = 12;
96 Type3 T3ILookChar = 13;
97 Type4 T4ILookChar = 14;
98
99 AnotherChildType AHILookInt = 15;
100
101 Speed* SPPtrILookHex = new Speed(16);
102
103 TestPoint iAmSomewhere(4,6);
104
105 i_am_cool *cool_pointer = (i_am_cool*)malloc(size: sizeof(i_am_cool)*3);
106 cool_pointer[0] = i_am_cool(3,-3.141592,'E');
107 cool_pointer[1] = i_am_cool(0,-3.141592,'E');
108 cool_pointer[2] = i_am_cool(0,-3.141592,'E');
109
110 i_am_cool cool_array[5];
111
112 cool_array[3].floating = 5.25;
113 cool_array[4].integer = 6;
114 cool_array[2].character = 'Q';
115
116 int int_array[] = {1,2,3,4,5};
117
118 IUseCharStar iEncapsulateCharStar;
119
120 char strarr[32] = "Hello world!";
121 char* strptr = "Hello world!";
122
123 i_am_cooler the_coolest_guy(1,2,3.14,6.28,'E','G');
124
125 has_local_mem_func_pointers();
126
127 return 0; // Set break point at this line.
128}
129
130

source code of lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp