Debian Codegraph @

clang/test/Analysis/bugfix-124477.m

raw
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,apiModeling,nullability.NullableDereferenced -x objective-c %s
2 /*
3 This test is reduced from a static analyzer crash. The bug causing
4 the crash is explained in #124477. It can only be triggered in some
5 rare cases so please do not modify this reproducer.
6 */
7
8 #pragma clang assume_nonnull begin
9 # 15 "some-sys-header.h" 1 3
10 @class NSArray, NSObject;
11
12 @interface Base
13 @property (readonly, copy) NSArray *array;
14 @end
15
16 #pragma clang assume_nonnull end
17 # 8 "this-file.m" 2
18
19
20 @interface Test : Base
21
22 @property (readwrite, copy, nullable) NSObject *label;
23 @property (readwrite, strong, nullable) Test * field;
24
25 - (void)f;
26
27 @end
28
29 @implementation Test
30 - (void)f
31 {
32 NSObject * X;
33
34 for (NSObject *ele in self.field.array) {}
35 self.label = X;
36 }
37 @end
38
39