Dominic Chen | 184c624 | 2017-03-03 18:02:02 +0000 | [diff] [blame] | 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.DumpTraversal %s | FileCheck %s |
| 2 | // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.DumpTraversal -DUSE_EXPR %s | FileCheck %s |
Jordan Rose | db72e2f | 2012-09-25 19:03:06 +0000 | [diff] [blame] | 3 | |
| 4 | int a(); |
| 5 | int b(); |
| 6 | int c(); |
| 7 | |
Jordan Rose | 902f02d | 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 | |
Devin Coughlin | 8d922aa | 2016-02-19 01:35:10 +0000 | [diff] [blame] | 14 | // CHECK: --BEGIN FUNCTION-- |
Jordan Rose | db72e2f | 2012-09-25 19:03:06 +0000 | [diff] [blame] | 15 | void testRemoveDeadBindings() { |
| 16 | int i = a(); |
Jordan Rose | 902f02d | 2012-09-25 19:03:09 +0000 | [diff] [blame] | 17 | if (CHECK(i)) |
Jordan Rose | db72e2f | 2012-09-25 19:03:06 +0000 | [diff] [blame] | 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 | |
Anna Zaks | 3fdcc0b | 2013-01-03 00:25:29 +0000 | [diff] [blame] | 28 | // CHECK: --END FUNCTION-- |
| 29 | // CHECK-NOT: --END FUNCTION-- |