aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Analysis/array-struct-region.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-09-28 17:15:21 +0000
committerJordan Rose <jordan_rose@apple.com>2012-09-28 17:15:21 +0000
commitb559f185842eef73066382adcdfda9255608ad6f (patch)
tree27b6d65ec3ba937b410fbd8b51272f9fd1c12e1f /clang/test/Analysis/array-struct-region.cpp
parente7126582a457b377df095ea2234d1206aaf9a4da (diff)
downloadllvm-b559f185842eef73066382adcdfda9255608ad6f.zip
llvm-b559f185842eef73066382adcdfda9255608ad6f.tar.gz
llvm-b559f185842eef73066382adcdfda9255608ad6f.tar.bz2
[analyzer] Create a temp region when a method is called on a struct rvalue.
An rvalue has no address, but calling a C++ member function requires a 'this' pointer. This commit makes the analyzer create a temporary region in which to store the struct rvalue and use as a 'this' pointer whenever a member function is called on an rvalue, which is essentially what CodeGen does. More of <rdar://problem/12137950>. The last part is tracking down the C++ FIXME in array-struct-region.cpp. llvm-svn: 164829
Diffstat (limited to 'clang/test/Analysis/array-struct-region.cpp')
-rw-r--r--clang/test/Analysis/array-struct-region.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Analysis/array-struct-region.cpp b/clang/test/Analysis/array-struct-region.cpp
index f610fbb2..22fbf2f 100644
--- a/clang/test/Analysis/array-struct-region.cpp
+++ b/clang/test/Analysis/array-struct-region.cpp
@@ -1,5 +1,7 @@
// 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
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core,debug.ExprInspection -DINLINE -verify -x c %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core,debug.ExprInspection -DINLINE -verify -x c++ -analyzer-config c++-inlining=constructors %s
void clang_analyzer_eval(int);
@@ -11,7 +13,14 @@ struct S {
#endif
};
+#ifdef INLINE
+struct S getS() {
+ struct S s = { 42 };
+ return s;
+}
+#else
struct S getS();
+#endif
void testAssignment() {