blob: 3bf6df731c2275f3761f94aab742f9b6dada23ea [file] [log] [blame]
Jordan Rosedb72e2f2012-09-25 19:03:06 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.DumpTraversal %s | FileCheck %s
Jordan Rose902f02d2012-09-25 19:03:09 +00002// RUN: %clang_cc1 -analyze -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--