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;
Point(int a,int b)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;
Data(int i)25 Data(int i):
26 id(i),
27 point(0, 0)
28 {}
29 };
30
main(int argc,char const * argv[])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 j = 0; j < 1000; ++j) {
42 bool dump = argc > 1; // Set breakpoint here.
43 // Evaluate a couple of expressions (2*1000 = 2000 exprs):
44 // expr ptr[j]->point.x
45 // expr ptr[j]->point.y
46 if (dump) {
47 printf("data[%d] = %d (%d, %d)\n", j, ptr[j]->id, ptr[j]->point.x, ptr[j]->point.y);
48 }
49 }
50 return 0;
51 }
52