Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class RawPtrRefMemberChecker
bool ignoreARC =
!PD->isReadOnly() && PD->getSetterKind() == ObjCPropertyDecl::Assign;
auto IsUnsafePtr = isUnsafePtr(QT, ignoreARC);
return {IsUnsafePtr && *IsUnsafePtr, PropType};
return {IsUnsafePtr && *IsUnsafePtr && !PD->isRetaining(), PropType};
}

bool shouldSkipDecl(const RecordDecl *RD) const {
Expand Down
7 changes: 3 additions & 4 deletions clang/test/Analysis/Checkers/WebKit/unretained-members.mm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ @interface AnotherObject : NSObject {
// expected-warning@-1{{Instance variable 'dispatch' in 'AnotherObject' is a retainable type 'dispatch_queue_t'}}
}
@property(nonatomic, readonly, strong) NSString *prop_string;
// expected-warning@-1{{Property 'prop_string' in 'AnotherObject' is a raw pointer to retainable type 'NSString'; member variables must be a RetainPtr}}
@property(nonatomic, readonly) NSString *prop_safe;
@end

Expand All @@ -132,7 +131,6 @@ @interface DerivedObject : AnotherObject {
// expected-warning@-1{{Instance variable 'os_dispatch' in 'DerivedObject' is a retainable type 'dispatch_queue_t'}}
}
@property(nonatomic, strong) NSNumber *prop_number;
// expected-warning@-1{{Property 'prop_number' in 'DerivedObject' is a raw pointer to retainable type 'NSNumber'; member variables must be a RetainPtr}}
@property(nonatomic, readonly) NSString *prop_string;
@end

Expand Down Expand Up @@ -178,12 +176,12 @@ @interface NoSynthObject : NSObject {
}
@property(nonatomic, readonly, strong) NSString *prop_string1;
@property(nonatomic, readonly, strong) NSString *prop_string2;
// expected-warning@-1{{Property 'prop_string2' in 'NoSynthObject' is a raw pointer to retainable type 'NSString'}}
@property(nonatomic, assign) NSString *prop_string3;
// expected-warning@-1{{Property 'prop_string3' in 'NoSynthObject' is a raw pointer to retainable type 'NSString'; member variables must be a RetainPtr}}
@property(nonatomic, unsafe_unretained) NSString *prop_string4;
// expected-warning@-1{{Property 'prop_string4' in 'NoSynthObject' is a raw pointer to retainable type 'NSString'; member variables must be a RetainPtr}}
@property(nonatomic, readonly, strong) NSString *dispatch;
@property(nonatomic, copy) NSString *prop_string5;
@property(nonatomic, readonly, strong) dispatch_queue_t dispatch;
@end

@implementation NoSynthObject
Expand All @@ -193,6 +191,7 @@ - (NSString *)prop_string1 {
@synthesize prop_string2;
@synthesize prop_string3;
@synthesize prop_string4;
@synthesize prop_string5;
- (dispatch_queue_t)dispatch {
return nil;
}
Expand Down