1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s
3 void clang_analyzer_eval(int);
4 void clang_analyzer_warnOnDeadSymbol(int);
6 namespace test_dead_region_with_live_subregion_in_environment
{
13 // FIXME: Maybe just let clang_analyzer_eval() work within callees already?
14 // The glob variable shouldn't keep our symbol alive because
15 // 'x != 0' is concrete 'true'.
24 clang_analyzer_warnOnDeadSymbol(a
.x
);
26 // What we're testing is that a.x is alive until foo() exits.
27 a
.foo(); // no-warning // (i.e., no 'SYMBOL DEAD' yet)
29 // Let's see if constraints on a.x were known within foo().
30 clang_analyzer_eval(glob
); // expected-warning{{TRUE}}
31 // expected-warning@-1{{SYMBOL DEAD}}
40 // This function ensures that the 'b' expression within its argument
41 // would be cleaned up before its call, so that only 'b.a' remains
42 // in the Environment.
51 clang_analyzer_warnOnDeadSymbol(b
.a
.x
);
53 // What we're testing is that b.a.x is alive until foo() exits.
54 noop(b
.a
).foo(); // no-warning // (i.e., no 'SYMBOL DEAD' yet)
56 // Let's see if constraints on a.x were known within foo().
57 clang_analyzer_eval(glob
); // expected-warning{{TRUE}}
58 // expected-warning@-1{{SYMBOL DEAD}}
60 } // namespace test_dead_region_with_live_subregion_in_environment