]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/main.cpp
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / data-formatter / data-formatter-synth / main.cpp
1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <stdint.h>
13
14 struct BagOfInts
15 {
16     int x;
17     int y;
18     int z;
19     BagOfInts(int X) :
20     x(X),
21     y(X+1),
22     z(X+2) {}
23 };
24
25 struct BagOfFloats
26 {
27     float x;
28     float y;
29     float z;
30     BagOfFloats(float X) :
31     x(X+0.334),
32     y(X+0.500),
33     z(X+0.667) {}
34 };
35
36 struct BagOfBags
37 {
38     BagOfInts x;
39     BagOfInts y;
40     BagOfFloats z;
41     BagOfFloats q;
42     BagOfBags() : 
43     x('E'),
44     y('B'),
45     z(1.1),
46     q(20.11) {}
47 };
48
49 struct EmptyStruct {};
50
51 struct Plenty
52 {
53     BagOfInts *some_values;
54     int* array;
55     int array_size;
56     int bitfield;
57     
58     Plenty(int N, bool flagA, bool flagB) :
59     some_values(new BagOfInts(N)),
60     array(new int[N]),
61     array_size(N),
62     bitfield( (flagA ? 0x01 : 0x00) | (flagB ? 0x10 : 0x00) )
63     {
64         for (int j = 0; j < N; j++)
65             array[j] = N-j;
66     }
67 };
68
69 int main (int argc, const char * argv[])
70 {
71     BagOfInts int_bag(6);
72     BagOfFloats float_bag(2.71);
73     
74     BagOfBags bag_bag;
75     EmptyStruct es;
76     
77     Plenty plenty_of_stuff(5,true,false);
78     
79     plenty_of_stuff.bitfield = 0x11; // Set break point at this line.
80     
81     bag_bag.x.z = 12;
82     
83     return 0;
84     
85 }
86