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 Plenty 50 { 51 BagOfInts *some_values; 52 int* array; 53 int array_size; 54 int bitfield; 55 56 Plenty(int N, bool flagA, bool flagB) : 57 some_values(new BagOfInts(N)), 58 array(new int[N]), 59 array_size(N), 60 bitfield( (flagA ? 0x01 : 0x00) | (flagB ? 0x10 : 0x00) ) 61 { 62 for (int j = 0; j < N; j++) 63 array[j] = N-j; 64 } 65 }; 66 67 int main (int argc, const char * argv[]) 68 { 69 BagOfInts int_bag(6); 70 BagOfFloats float_bag(2.71); 71 72 BagOfBags bag_bag; 73 74 Plenty plenty_of_stuff(5,true,false); 75 76 plenty_of_stuff.bitfield = 0x11; // Set break point at this line. 77 78 bag_bag.x.z = 12; 79 80 return 0; 81 82 } 83 84