diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
commit | c72c57c9e9b69944e3e009cd5e209634839581d3 (patch) | |
tree | 4fc2f184c499d106f29a386c452b49e5197bf63d /test/Analysis/blocks-no-inline.c | |
parent | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff) | |
download | FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz |
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'test/Analysis/blocks-no-inline.c')
-rw-r--r-- | test/Analysis/blocks-no-inline.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/test/Analysis/blocks-no-inline.c b/test/Analysis/blocks-no-inline.c index 1ec14e8..de6f959 100644 --- a/test/Analysis/blocks-no-inline.c +++ b/test/Analysis/blocks-no-inline.c @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-ipa=none -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config ipa=none -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config ipa=none -fblocks -verify -x c++ %s void clang_analyzer_eval(int); @@ -11,3 +12,29 @@ void testInvalidation() { // Under inlining, we will know that i == 1. clang_analyzer_eval(i == 0); // expected-warning{{UNKNOWN}} } + + +const int globalConstant = 1; +void testCapturedConstants() { + const int localConstant = 2; + static const int staticConstant = 3; + + ^{ + clang_analyzer_eval(globalConstant == 1); // expected-warning{{TRUE}} + clang_analyzer_eval(localConstant == 2); // expected-warning{{TRUE}} + clang_analyzer_eval(staticConstant == 3); // expected-warning{{TRUE}} + }(); +} + +typedef const int constInt; +constInt anotherGlobalConstant = 1; +void testCapturedConstantsTypedef() { + constInt localConstant = 2; + static constInt staticConstant = 3; + + ^{ + clang_analyzer_eval(anotherGlobalConstant == 1); // expected-warning{{TRUE}} + clang_analyzer_eval(localConstant == 2); // expected-warning{{TRUE}} + clang_analyzer_eval(staticConstant == 3); // expected-warning{{TRUE}} + }(); +} |