Add 'alloca' test case for return-of-stack-address checker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58554 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/stack-addr-ps.c b/test/Analysis/stack-addr-ps.c
index bc046cd..2173cac 100644
--- a/test/Analysis/stack-addr-ps.c
+++ b/test/Analysis/stack-addr-ps.c
@@ -1,5 +1,7 @@
// RUN: clang -checker-simple -verify %s
+#include <stdlib.h>
+
int* f1() {
int x = 0;
return &x; // expected-warning{{Address of stack memory associated with local variable 'x' returned.}} expected-warning{{address of stack memory associated with local variable 'x' returned}}
@@ -33,3 +35,8 @@
return p; // expected-warning{{Address of stack memory}}
}
+void* alloca_test() {
+ void* p = alloca(10);
+ return p; // expected-warning{{Address of stack memory}}
+}
+