Home | History | Annotate | Download | only in Analysis
      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 // CHECK: --BEGIN FUNCTION--
     15 void testRemoveDeadBindings() {
     16   int i = a();
     17   if (CHECK(i))
     18     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 
     28 // CHECK: --END FUNCTION--
     29 // CHECK-NOT: --END FUNCTION--
     30