xref: /minix3/external/bsd/llvm/dist/clang/test/Analysis/traversal-path-unification.c (revision eda6f5931d42c77e1480347b1fc3eef2f8d33806)
1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.DumpTraversal %s | FileCheck %s
2 // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.DumpTraversal -DUSE_EXPR %s | FileCheck %s
3 
4 int a();
5 int b();
6 int c();
7 
8 #ifdef USE_EXPR
9 #define CHECK(x) ((x) & 1)
10 #else
11 #define CHECK(x) (x)
12 #endif
13 
14 void testRemoveDeadBindings() {
15   int i = a();
16   if (CHECK(i))
17     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 
27 // CHECK: --END FUNCTION--
28 // CHECK-NOT: --END FUNCTION--
29