From e8e29276b6864a489bf198c8fa29b1d08c176cc7 Mon Sep 17 00:00:00 2001 From: Artem Dergachev Date: Sat, 19 Oct 2019 01:50:43 +0000 Subject: [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 --- .../Analysis/track-control-dependency-conditions.m | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/Analysis/track-control-dependency-conditions.m (limited to 'test') 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 -- cgit v1.2.1