blob: 83e3b87c2bb347488982e4280ad1aa951f687bbf [file] [log] [blame]
Jordan Rose0073a5c2012-09-25 19:03:06 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.DumpTraversal %s | FileCheck %s
Jordan Rosebf7f77a2012-09-25 19:03:09 +00002// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.DumpTraversal -DUSE_EXPR %s | FileCheck %s
Jordan Rose0073a5c2012-09-25 19:03:06 +00003
4int a();
5int b();
6int c();
7
Jordan Rosebf7f77a2012-09-25 19:03:09 +00008#ifdef USE_EXPR
9#define CHECK(x) ((x) & 1)
10#else
11#define CHECK(x) (x)
12#endif
13
Jordan Rose0073a5c2012-09-25 19:03:06 +000014void testRemoveDeadBindings() {
15 int i = a();
Jordan Rosebf7f77a2012-09-25 19:03:09 +000016 if (CHECK(i))
Jordan Rose0073a5c2012-09-25 19:03:06 +000017 a();
18 else
19 b();
20
21 // At this point the symbol bound to 'i' is dead.
22 // The effects of a() and b() are identical (they both invalidate globals).
23 // We should unify the two paths here and only get one end-of-path node.
24 c();
25}
26
Anna Zaks344c77a2013-01-03 00:25:29 +000027// CHECK: --END FUNCTION--
28// CHECK-NOT: --END FUNCTION--