1 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,debug.ExprInspection -analyzer-config ipa=none -fblocks -analyzer-config eagerly-assume=false -verify %s
2 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,debug.ExprInspection -analyzer-config ipa=none -fblocks -analyzer-config eagerly-assume=false -verify -x c++ %s
4 void clang_analyzer_eval(int);
6 void testInvalidation(void) {
12 // Under inlining, we will know that i == 1.
13 clang_analyzer_eval(i
== 0); // expected-warning{{UNKNOWN}}
17 const int globalConstant
= 1;
18 void testCapturedConstants(void) {
19 const int localConstant
= 2;
20 static const int staticConstant
= 3;
23 clang_analyzer_eval(globalConstant
== 1); // expected-warning{{TRUE}}
24 clang_analyzer_eval(localConstant
== 2); // expected-warning{{TRUE}}
25 clang_analyzer_eval(staticConstant
== 3); // expected-warning{{TRUE}}
29 typedef const int constInt
;
30 constInt anotherGlobalConstant
= 1;
31 void testCapturedConstantsTypedef(void) {
32 constInt localConstant
= 2;
33 static constInt staticConstant
= 3;
36 clang_analyzer_eval(anotherGlobalConstant
== 1); // expected-warning{{TRUE}}
37 clang_analyzer_eval(localConstant
== 2); // expected-warning{{TRUE}}
38 clang_analyzer_eval(staticConstant
== 3); // expected-warning{{TRUE}}