diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-09-05 17:11:15 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-09-05 17:11:15 +0000 |
commit | fd11957f02da689480618d5fc642ef14164e9cdc (patch) | |
tree | caf99cc93fa3809106e055ec603a91b8ea0a249a /test/Analysis/array-struct-region.cpp | |
parent | a78d0d6203a990b88c9c3e4c4f2a277001e8bd46 (diff) |
Revert "[analyzer] Treat all struct values as regions (even rvalues)."
This turned out to have many implications, but what eventually seemed to
make it unworkable was the fact that we can get struct values (as
LazyCompoundVals) from other places besides return-by-value function calls;
that is, we weren't actually able to "treat all struct values as regions"
consistently across the entire analyzer core.
Hopefully we'll be able to come up with an alternate solution soon.
This reverts r163066 / 02df4f0aef142f00d4637cd851e54da2a123ca8e.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163218 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/array-struct-region.cpp')
-rw-r--r-- | test/Analysis/array-struct-region.cpp | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/test/Analysis/array-struct-region.cpp b/test/Analysis/array-struct-region.cpp deleted file mode 100644 index 3581566bdc..0000000000 --- a/test/Analysis/array-struct-region.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core,debug.ExprInspection -verify -x c %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core,debug.ExprInspection -verify -x c++ -analyzer-config c++-inlining=constructors %s - -void clang_analyzer_eval(int); - -struct S { - int field; - -#if __cplusplus - const struct S *getThis() const { return this; } -#endif -}; - -struct S getS(); - - -void testAssignment() { - struct S s = getS(); - - if (s.field != 42) return; - clang_analyzer_eval(s.field == 42); // expected-warning{{TRUE}} - - s.field = 0; - clang_analyzer_eval(s.field == 0); // expected-warning{{TRUE}} - -#if __cplusplus - clang_analyzer_eval(s.getThis() == &s); // expected-warning{{TRUE}} -#endif -} - - -void testImmediateUse() { - int x = getS().field; - - if (x != 42) return; - clang_analyzer_eval(x == 42); // expected-warning{{TRUE}} - -#if __cplusplus - clang_analyzer_eval((void *)getS().getThis() == (void *)&x); // expected-warning{{FALSE}} -#endif -} - -int getConstrainedField(struct S s) { - if (s.field != 42) return 42; - return s.field; -} - -int getAssignedField(struct S s) { - s.field = 42; - return s.field; -} - -void testArgument() { - clang_analyzer_eval(getConstrainedField(getS()) == 42); // expected-warning{{TRUE}} - clang_analyzer_eval(getAssignedField(getS()) == 42); // expected-warning{{TRUE}} -} - - -//-------------------- -// C++-only tests -//-------------------- - -#if __cplusplus -void testReferenceAssignment() { - const S &s = getS(); - - if (s.field != 42) return; - clang_analyzer_eval(s.field == 42); // expected-warning{{TRUE}} - - clang_analyzer_eval(s.getThis() == &s); // expected-warning{{TRUE}} -} - - -int getConstrainedFieldRef(const S &s) { - if (s.field != 42) return 42; - return s.field; -} - -bool checkThis(const S &s) { - return s.getThis() == &s; -} - -void testReferenceArgument() { - clang_analyzer_eval(getConstrainedFieldRef(getS()) == 42); // expected-warning{{TRUE}} - clang_analyzer_eval(checkThis(getS())); // expected-warning{{TRUE}} -} -#endif |