Jordan Rose | 0073a5c | 2012-09-25 19:03:06 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.DumpTraversal %s | FileCheck %s |
Jordan Rose | bf7f77a | 2012-09-25 19:03:09 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.DumpTraversal -DUSE_EXPR %s | FileCheck %s |
Jordan Rose | 0073a5c | 2012-09-25 19:03:06 +0000 | [diff] [blame] | 3 | |
| 4 | int a(); |
| 5 | int b(); |
| 6 | int c(); |
| 7 | |
Jordan Rose | bf7f77a | 2012-09-25 19:03:09 +0000 | [diff] [blame] | 8 | #ifdef USE_EXPR |
| 9 | #define CHECK(x) ((x) & 1) |
| 10 | #else |
| 11 | #define CHECK(x) (x) |
| 12 | #endif |
| 13 | |
Jordan Rose | 0073a5c | 2012-09-25 19:03:06 +0000 | [diff] [blame] | 14 | void testRemoveDeadBindings() { |
| 15 | int i = a(); |
Jordan Rose | bf7f77a | 2012-09-25 19:03:09 +0000 | [diff] [blame] | 16 | if (CHECK(i)) |
Jordan Rose | 0073a5c | 2012-09-25 19:03:06 +0000 | [diff] [blame] | 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 | |
Anna Zaks | 344c77a | 2013-01-03 00:25:29 +0000 | [diff] [blame] | 27 | // CHECK: --END FUNCTION-- |
| 28 | // CHECK-NOT: --END FUNCTION-- |