aboutsummaryrefslogtreecommitdiff
path: root/src/relooper/test_dead.cpp
blob: 5c9fde1bd5e3e5afbddceeb3821054d21894a5aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "Relooper.h"

int main() {
  char buffer[10000];

  Relooper::SetOutputBuffer(buffer, sizeof(buffer));

  printf("\n\n-- If pattern --\n\n");

  Block *b_a = new Block("// block A\n", "the_var");
  Block *b_b = new Block("// block B\n", "waka"); // never reached

  b_b->AddBranchTo(b_b, NULL);

  Relooper r;
  r.AddBlock(b_a);
  r.AddBlock(b_b);

  r.Calculate(b_a);
  printf("\n\n");
  r.Render();

  puts(buffer);

  printf("I did not crash even though I have dead code with a branch!\n");
}