aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/method-call.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-08-27 17:50:07 +0000
committerJordan Rose <jordan_rose@apple.com>2012-08-27 17:50:07 +0000
commitc210cb7a358d14cdd93b58562f33ff5ed2d895c1 (patch)
tree3e97742793c7a88ed7377cfc8ac1476474bc37c0 /test/Analysis/method-call.cpp
parentbe22cb84f32cfa6cf0b6bdaf523288b747bb0f18 (diff)
[analyzer] Inline constructors for any object with a trivial destructor.
This allows us to better reason about status objects, like Clang's own llvm::Optional (when its contents are trivially destructible), which are often intended to be passed around by value. We still don't inline constructors for temporaries in the general case. <rdar://problem/11986434> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/method-call.cpp')
-rw-r--r--test/Analysis/method-call.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/test/Analysis/method-call.cpp b/test/Analysis/method-call.cpp
index 912062739c..65bd5155dd 100644
--- a/test/Analysis/method-call.cpp
+++ b/test/Analysis/method-call.cpp
@@ -15,23 +15,22 @@ void testNullObject(A *a) {
clang_analyzer_eval(a); // expected-warning{{TRUE}}
}
-
-// FIXME: These require constructor inlining to be enabled.
-
void f1() {
A x(3);
- // should be TRUE
- clang_analyzer_eval(x.getx() == 3); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
}
void f2() {
const A &x = A(3);
- // should be TRUE
- clang_analyzer_eval(x.getx() == 3); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
}
void f3() {
const A &x = (A)3;
- // should be TRUE
- clang_analyzer_eval(x.getx() == 3); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
+}
+
+void f4() {
+ A x = 3;
+ clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
}