2017-03-04 02:02:02 +08:00
|
|
|
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.DumpTraversal %s | FileCheck %s
|
|
|
|
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.DumpTraversal -DUSE_EXPR %s | FileCheck %s
|
2012-09-26 03:03:06 +08:00
|
|
|
|
|
|
|
int a();
|
|
|
|
int b();
|
|
|
|
int c();
|
|
|
|
|
2012-09-26 03:03:09 +08:00
|
|
|
#ifdef USE_EXPR
|
|
|
|
#define CHECK(x) ((x) & 1)
|
|
|
|
#else
|
|
|
|
#define CHECK(x) (x)
|
|
|
|
#endif
|
|
|
|
|
2016-02-19 09:35:10 +08:00
|
|
|
// CHECK: --BEGIN FUNCTION--
|
2012-09-26 03:03:06 +08:00
|
|
|
void testRemoveDeadBindings() {
|
|
|
|
int i = a();
|
2012-09-26 03:03:09 +08:00
|
|
|
if (CHECK(i))
|
2012-09-26 03:03:06 +08:00
|
|
|
a();
|
|
|
|
else
|
|
|
|
b();
|
|
|
|
|
|
|
|
// At this point the symbol bound to 'i' is dead.
|
|
|
|
// The effects of a() and b() are identical (they both invalidate globals).
|
|
|
|
// We should unify the two paths here and only get one end-of-path node.
|
|
|
|
c();
|
|
|
|
}
|
|
|
|
|
2013-01-03 08:25:29 +08:00
|
|
|
// CHECK: --END FUNCTION--
|
|
|
|
// CHECK-NOT: --END FUNCTION--
|