1 //===-- main.cpp ------------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include <stdio.h> 10 #include <stdlib.h> 11 #include <stdint.h> 12 13 struct BagOfInts 14 { 15 int x; 16 int y; 17 int z; 18 BagOfInts(int X) : 19 x(X), 20 y(X+1), 21 z(X+2) {} 22 }; 23 24 struct BagOfFloats 25 { 26 float x; 27 float y; 28 float z; 29 BagOfFloats(float X) : 30 x(X+0.334), 31 y(X+0.500), 32 z(X+0.667) {} 33 }; 34 35 struct BagOfBags 36 { 37 BagOfInts x; 38 BagOfInts y; 39 BagOfFloats z; 40 BagOfFloats q; 41 BagOfBags() : 42 x('E'), 43 y('B'), 44 z(1.1), 45 q(20.11) {} 46 }; 47 48 struct EmptyStruct {}; 49 50 struct Plenty 51 { 52 BagOfInts *some_values; 53 int* array; 54 int array_size; 55 int bitfield; 56 57 Plenty(int N, bool flagA, bool flagB) : 58 some_values(new BagOfInts(N)), 59 array(new int[N]), 60 array_size(N), 61 bitfield( (flagA ? 0x01 : 0x00) | (flagB ? 0x10 : 0x00) ) 62 { 63 for (int j = 0; j < N; j++) 64 array[j] = N-j; 65 } 66 }; 67 68 int main (int argc, const char * argv[]) 69 { 70 BagOfInts int_bag(6); 71 BagOfFloats float_bag(2.71); 72 73 BagOfBags bag_bag; 74 EmptyStruct es; 75 76 Plenty plenty_of_stuff(5,true,false); 77 78 plenty_of_stuff.bitfield = 0x11; // Set break point at this line. 79 80 bag_bag.x.z = 12; 81 82 return 0; 83 84 } 85 86