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