summaryrefslogtreecommitdiff
path: root/test/Analysis/objc-for.m
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/objc-for.m')
-rw-r--r--test/Analysis/objc-for.m14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/Analysis/objc-for.m b/test/Analysis/objc-for.m
index 1561ef8ddf85..ef149c4b14aa 100644
--- a/test/Analysis/objc-for.m
+++ b/test/Analysis/objc-for.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=osx.cocoa.Loops,debug.ExprInspection -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.Loops,debug.ExprInspection -verify %s
void clang_analyzer_eval(int);
@@ -56,3 +56,15 @@ void testWithVarInFor() {
clang_analyzer_eval(x != nil); // expected-warning{{UNKNOWN}}
}
+void testNonNil(id a, id b) {
+ clang_analyzer_eval(a != nil); // expected-warning{{UNKNOWN}}
+ for (id x in a)
+ clang_analyzer_eval(a != nil); // expected-warning{{TRUE}}
+
+ if (b != nil)
+ return;
+ for (id x in b)
+ *(volatile int *)0 = 1; // no-warning
+ clang_analyzer_eval(b != nil); // expected-warning{{FALSE}}
+}
+