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