summaryrefslogtreecommitdiffstats
path: root/test/Analysis/reference.mm
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/reference.mm')
-rw-r--r--test/Analysis/reference.mm17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Analysis/reference.mm b/test/Analysis/reference.mm
new file mode 100644
index 0000000..c5546aa
--- /dev/null
+++ b/test/Analysis/reference.mm
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -Wno-null-dereference %s
+
+@interface Foo
+- (int &)ref;
+@end
+
+Foo *getFoo() { return 0; }
+
+void testNullPointerSuppression() {
+ getFoo().ref = 1;
+}
+
+void testPositiveNullReference() {
+ Foo *x = 0;
+ x.ref = 1; // expected-warning {{The receiver of message 'ref' is nil, which results in forming a null reference}}
+}
+
OpenPOWER on IntegriCloud