Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / python_api / value / linked_list / main.cpp
blob13982bfe9818fe09e9aa111c3b01ff3c33e2b5d0
1 #include <stdio.h>
3 class Task {
4 public:
5 int id;
6 Task *next;
7 Task(int i, Task *n):
8 id(i),
9 next(n)
14 int main (int argc, char const *argv[])
16 Task *task_head = NULL;
17 Task *task1 = new Task(1, NULL);
18 Task *task2 = new Task(2, NULL);
19 Task *task3 = new Task(3, NULL); // Orphaned.
20 Task *task4 = new Task(4, NULL);
21 Task *task5 = new Task(5, NULL);
23 task_head = task1;
24 task1->next = task2;
25 task2->next = task4;
26 task4->next = task5;
28 int total = 0;
29 Task *t = task_head;
30 while (t != NULL) {
31 if (t->id >= 0)
32 ++total;
33 t = t->next;
35 printf("We have a total number of %d tasks\n", total);
37 // This corresponds to an empty task list.
38 Task *empty_task_head = NULL;
40 Task *task_evil = new Task(1, NULL);
41 Task *task_2 = new Task(2, NULL);
42 Task *task_3 = new Task(3, NULL);
43 task_evil->next = task_2;
44 task_2->next = task_3;
45 task_3->next = task_evil; // In order to cause inifinite loop. :-)
47 return 0; // Break at this line