blob: 28a15110f903eb7404a00757534a2516c1caec56 [file] [log] [blame]
Dominic Chen184c6242017-03-03 18:02:02 +00001// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.DumpTraversal %s | FileCheck %s
2// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.DumpTraversal -DUSE_EXPR %s | FileCheck %s
Jordan Rosedb72e2f2012-09-25 19:03:06 +00003
4int a();
5int b();
6int c();
7
Jordan Rose902f02d2012-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
Devin Coughlin8d922aa2016-02-19 01:35:10 +000014// CHECK: --BEGIN FUNCTION--
Jordan Rosedb72e2f2012-09-25 19:03:06 +000015void testRemoveDeadBindings() {
16 int i = a();
Jordan Rose902f02d2012-09-25 19:03:09 +000017 if (CHECK(i))
Jordan Rosedb72e2f2012-09-25 19:03:06 +000018 a();
19 else
20 b();
21
22 // At this point the symbol bound to 'i' is dead.
23 // The effects of a() and b() are identical (they both invalidate globals).
24 // We should unify the two paths here and only get one end-of-path node.
25 c();
26}
27
Anna Zaks3fdcc0b2013-01-03 00:25:29 +000028// CHECK: --END FUNCTION--
29// CHECK-NOT: --END FUNCTION--