summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-10-19 01:50:43 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2019-10-19 01:50:43 +0000
commite8e29276b6864a489bf198c8fa29b1d08c176cc7 (patch)
treeed1a80c7c2c5cb965feb6347e4cad2cd729d57e6 /test
parent830e5706050ff05d26311e5e8c63cdf697601164 (diff)
downloadclang-e8e29276b6864a489bf198c8fa29b1d08c176cc7.tar.gz
[analyzer] Fix a crash on tracking Objective-C 'self' as a control dependency.
'self' was previously never tracked, but now it can be tracked because it may be part of a condition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375328 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Analysis/track-control-dependency-conditions.m32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/Analysis/track-control-dependency-conditions.m b/test/Analysis/track-control-dependency-conditions.m
new file mode 100644
index 0000000000..05b0638a5e
--- /dev/null
+++ b/test/Analysis/track-control-dependency-conditions.m
@@ -0,0 +1,32 @@
+// RUN: %clang_analyze_cc1 -w -analyzer-checker=core,nullability -verify %s
+
+// expected-no-diagnostics
+
+@class C;
+
+#pragma clang assume_nonnull begin
+@interface I
+- foo:(C *)c;
+@end
+#pragma clang assume_nonnull end
+
+@interface J
+@property C *c;
+@end
+
+J *conjure_J();
+
+@implementation I
+- (void)bar {
+ if (self) { // no-crash
+ J *j = conjure_J();
+ if (j.c)
+ [self bar];
+ // FIXME: Should warn.
+ [self foo:j.c]; // no-warning
+ }
+}
+@end
+
+@implementation J
+@end