llvm-project/clang/test/Analysis/bugfix-124477.m
Donát Nagy 4c8f434409
[analyzer] Conversion to CheckerFamily: NullabilityChecker (#143735)
This commit converts NullabilityChecker to the new checker family
framework that was introduced in the recent commit
6833076a5d9f5719539a24e900037da5a3979289

This commit removes the dummy checker `nullability.NullabilityBase`
because it was hidden from the users and didn't have any useful role
except for helping the registration of the checker parts in the old
ad-hoc system (which is replaced by the new standardized framework).

Except for the removal of this dummy checker, no functional changes
intended.
2025-06-17 11:51:09 +02:00

40 lines
801 B
Objective-C

// RUN: %clang_analyze_cc1 -analyzer-checker=core,apiModeling,nullability.NullableDereferenced -x objective-c %s
/*
This test is reduced from a static analyzer crash. The bug causing
the crash is explained in #124477. It can only be triggered in some
rare cases so please do not modify this reproducer.
*/
#pragma clang assume_nonnull begin
# 15 "some-sys-header.h" 1 3
@class NSArray, NSObject;
@interface Base
@property (readonly, copy) NSArray *array;
@end
#pragma clang assume_nonnull end
# 8 "this-file.m" 2
@interface Test : Base
@property (readwrite, copy, nullable) NSObject *label;
@property (readwrite, strong, nullable) Test * field;
- (void)f;
@end
@implementation Test
- (void)f
{
NSObject * X;
for (NSObject *ele in self.field.array) {}
self.label = X;
}
@end