aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/stack-block-returned.cpp
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2011-08-26 00:41:31 +0000
committerJeffrey Yasskin <jyasskin@google.com>2011-08-26 00:41:31 +0000
commit782f63ecd124f9384f988dc7e0cf4ae1540c15f6 (patch)
tree8aa780ecf69dc68dedfb5ad1b2a171ea2ba9c164 /test/Analysis/stack-block-returned.cpp
parent1b9060553221720152e12981109549e0a1d8e3a1 (diff)
Handle CXXTempObjectRegion in StackAddrEscapeChecker.
Also convert stack-addr-ps.cpp to use the analyzer instead of just Sema, now that it doesn't crash, and extract the stack-block test into another file since it errors, and that prevents the analyzer from running. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/stack-block-returned.cpp')
-rw-r--r--test/Analysis/stack-block-returned.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Analysis/stack-block-returned.cpp b/test/Analysis/stack-block-returned.cpp
new file mode 100644
index 0000000000..af2cec7766
--- /dev/null
+++ b/test/Analysis/stack-block-returned.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -fblocks -verify %s
+
+typedef void (^bptr)(void);
+
+bptr bf(int j) {
+ __block int i;
+ const bptr &qq = ^{ i=0; }; // expected-note {{binding reference variable 'qq' here}}
+ return qq; // expected-error {{returning block that lives on the local stack}}
+}