-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[alpha.webkit.RawPtrRefMemberChecker] The checker doesn't warn Objective-C types in ivars. #132833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
ca50dee
d72d243
c3796e7
a46ce85
800f4ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.NoUnretainedMemberChecker -verify %s | ||
|
|
||
| #include "objc-mock-types.h" | ||
| #include "mock-system-header.h" | ||
|
|
||
| namespace members { | ||
|
|
||
|
|
@@ -58,3 +59,13 @@ void forceTmplToInstantiate(FooTmpl<SomeObj, CFMutableArrayRef>) {} | |
|
|
||
| void forceTmplToInstantiate(RefPtr<SomeObj>) {} | ||
| } | ||
|
|
||
| @interface AnotherObject : NSObject { | ||
| NSString *ns_string; | ||
| // expected-warning@-1{{Instance variable 'ns_string' in 'AnotherObject' is a raw pointer to retainable type 'NSString'; member variables must be a RetainPtr}} | ||
| CFStringRef cf_string; | ||
| // expected-warning@-1{{Instance variable 'cf_string' in 'AnotherObject' is a retainable type 'CFStringRef'; member variables must be a RetainPtr}} | ||
| } | ||
| @property(nonatomic, 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}} | ||
| @end | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is more of a question for my understanding: Do we expect the same behavior for raw pointers that are properties?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a test case for properties?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turns out I have to enumerate properties separately from ivars. Added a test with code fix. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh oops, I forgot to remove this.