aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/array-struct-region.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-10-17 19:35:44 +0000
committerJordan Rose <jordan_rose@apple.com>2012-10-17 19:35:44 +0000
commitd4ce811ae08398e357c8ce3e707ba5f2aa0041a5 (patch)
treeea1b27bdfb6358d3627ca4c3c2639656385f5e9b /test/Analysis/array-struct-region.cpp
parentf1e67d75fc922ff905de9faa6326bb1a96685ec1 (diff)
[analyzer] When binding to a ParenExpr, bind to its inner expression instead.
This actually looks through several kinds of expression, such as OpaqueValueExpr and ExprWithCleanups. The idea is that binding and lookup should be consistent, and so if the environment needs to be modified later, the code doing the modification will not have to manually look through these "transparent" expressions to find the real binding to change. This is necessary for proper updating of struct rvalues as described in the previous commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166121 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/array-struct-region.cpp')
-rw-r--r--test/Analysis/array-struct-region.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Analysis/array-struct-region.cpp b/test/Analysis/array-struct-region.cpp
index cffa64d21a..12ae5d3eba 100644
--- a/test/Analysis/array-struct-region.cpp
+++ b/test/Analysis/array-struct-region.cpp
@@ -90,6 +90,22 @@ void testArgument() {
clang_analyzer_eval(getAssignedField(getS()) == 42); // expected-warning{{TRUE}}
}
+void testImmediateUseParens() {
+ int x = ((getS())).field;
+
+ if (x != 42) return;
+ clang_analyzer_eval(x == 42); // expected-warning{{TRUE}}
+
+ clang_analyzer_eval(getConstrainedField(((getS()))) == 42); // expected-warning{{TRUE}}
+ clang_analyzer_eval(getAssignedField(((getS()))) == 42); // expected-warning{{TRUE}}
+
+#if __cplusplus
+ clang_analyzer_eval(((getS())).check()); // expected-warning{{TRUE}}
+ clang_analyzer_eval(!((getS()))); // expected-warning{{FALSE}}
+ clang_analyzer_eval(~((getS()))); // expected-warning{{FALSE}}
+#endif
+}
+
//--------------------
// C++-only tests