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