[clang] [alpha.webkit.RawPtrRefMemberChecker] The checker doesn't warn Objective-C types in ivars. (PR #132833)

Rashmi Mudduluru via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 26 15:06:13 PDT 2025


================
@@ -58,3 +59,11 @@ void forceTmplToInstantiate(FooTmpl<SomeObj, CFMutableArrayRef>) {}
 
   void forceTmplToInstantiate(RefPtr<SomeObj>) {}
 }
+
+ at interface AnotherObject : NSObject {
+  NSString *ns_string;
+  // expected-warning at -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 at -1{{Instance variable 'cf_string' in 'AnotherObject' is a retainable type 'CFStringRef'; member variables must be a RetainPtr}}
+}
+ at end
----------------
t-rasmud wrote:

This is more of a question for my understanding: Do we expect the same behavior for raw pointers that are properties?
```
@interface AnotherObject : NSObject
@property(nonatomic,strong) NSString *prop_string;
@end
```

https://github.com/llvm/llvm-project/pull/132833


More information about the cfe-commits mailing list