summaryrefslogtreecommitdiff
path: root/test/Analysis/static_local.m
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/static_local.m')
-rw-r--r--test/Analysis/static_local.m19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Analysis/static_local.m b/test/Analysis/static_local.m
new file mode 100644
index 000000000000..dcd49e11a16c
--- /dev/null
+++ b/test/Analysis/static_local.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
+
+// Test reasoning about static locals in ObjCMethods.
+int *getValidPtr();
+@interface Radar11275803
+- (int) useStaticInMethod;
+@end
+@implementation Radar11275803
+
+- (int) useStaticInMethod
+{
+ static int *explInit = 0;
+ static int implInit;
+ if (!implInit)
+ explInit = getValidPtr();
+ return *explInit; //no-warning
+}
+@end \ No newline at end of file