summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/stack-addr-ps.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-02-22 01:51:15 +0000
committerJordan Rose <jordan_rose@apple.com>2013-02-22 01:51:15 +0000
commit5772f82d1eaf8284fe2f2d637282091a484c13a4 (patch)
treea0c1b8bbdfdb097d5f5c03907d0798d20cdb5392 /clang/test/Analysis/stack-addr-ps.cpp
parent047f81a5dfe84dab8968f7f45a401bd643b27dd8 (diff)
downloadbcm5719-llvm-5772f82d1eaf8284fe2f2d637282091a484c13a4.tar.gz
bcm5719-llvm-5772f82d1eaf8284fe2f2d637282091a484c13a4.zip
[analyzer] Make sure a materialized temporary matches its bindings.
This is a follow-up to r175830, which made sure a temporary object region created for, say, a struct rvalue matched up with the initial bindings being stored into it. This does the same for the case in which the AST actually tells us that we need to create a temporary via a MaterializeObjectExpr. I've unified the two code paths and moved a static helper function onto ExprEngine. This also caused a bit of test churn, causing us to go back to describing temporary regions without a 'const' qualifier. This seems acceptable; it's our behavior from a few months ago. <rdar://problem/13265460> (part 2) llvm-svn: 175854
Diffstat (limited to 'clang/test/Analysis/stack-addr-ps.cpp')
-rw-r--r--clang/test/Analysis/stack-addr-ps.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/test/Analysis/stack-addr-ps.cpp b/clang/test/Analysis/stack-addr-ps.cpp
index 9dd63f83c67..7aefea5095c 100644
--- a/clang/test/Analysis/stack-addr-ps.cpp
+++ b/clang/test/Analysis/stack-addr-ps.cpp
@@ -22,17 +22,17 @@ const int& g3() {
int get_value();
-const int &get_reference1() { return get_value(); } // expected-warning{{Address of stack memory associated with temporary object of type 'const int' returned}} expected-warning {{returning reference to local temporary}}
+const int &get_reference1() { return get_value(); } // expected-warning{{Address of stack memory associated with temporary object of type 'int' returned}} expected-warning {{returning reference to local temporary}}
const int &get_reference2() {
const int &x = get_value(); // expected-note {{binding reference variable 'x' here}}
- return x; // expected-warning{{Address of stack memory associated with temporary object of type 'const int' returned}} expected-warning {{returning reference to local temporary}}
+ return x; // expected-warning{{Address of stack memory associated with temporary object of type 'int' returned}} expected-warning {{returning reference to local temporary}}
}
const int &get_reference3() {
const int &x1 = get_value(); // expected-note {{binding reference variable 'x1' here}}
const int &x2 = x1; // expected-note {{binding reference variable 'x2' here}}
- return x2; // expected-warning{{Address of stack memory associated with temporary object of type 'const int' returned}} expected-warning {{returning reference to local temporary}}
+ return x2; // expected-warning{{Address of stack memory associated with temporary object of type 'int' returned}} expected-warning {{returning reference to local temporary}}
}
int global_var;
@@ -56,7 +56,7 @@ int *f3() {
const int *f4() {
const int &x1 = get_value(); // expected-note {{binding reference variable 'x1' here}}
const int &x2 = x1; // expected-note {{binding reference variable 'x2' here}}
- return &x2; // expected-warning{{Address of stack memory associated with temporary object of type 'const int' returned}} expected-warning {{returning address of local temporary}}
+ return &x2; // expected-warning{{Address of stack memory associated with temporary object of type 'int' returned}} expected-warning {{returning address of local temporary}}
}
struct S {
OpenPOWER on IntegriCloud