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 #include <stdio.h> 10 11 class Point { 12 public: 13 int x; 14 int y; 15 Point(int a, int b): 16 x(a), 17 y(b) 18 {} 19 }; 20 21 class Data { 22 public: 23 int id; 24 Point point; 25 Data(int i): 26 id(i), 27 point(0, 0) 28 {} 29 }; 30 31 int main(int argc, char const *argv[]) { 32 Data *data[1000]; 33 Data **ptr = data; 34 for (int i = 0; i < 1000; ++i) { 35 ptr[i] = new Data(i); 36 ptr[i]->point.x = i; 37 ptr[i]->point.y = i+1; 38 } 39 40 printf("Finished populating data.\n"); 41 for (int i = 0; i < 1000; ++i) { 42 bool dump = argc > 1; // Set breakpoint here. 43 // Evaluate a couple of expressions (2*1000 = 2000 exprs): 44 // expr ptr[i]->point.x 45 // expr ptr[i]->point.y 46 if (dump) { 47 printf("data[%d] = %d (%d, %d)\n", i, ptr[i]->id, ptr[i]->point.x, ptr[i]->point.y); 48 } 49 } 50 return 0; 51 } 52