[clang] [alpha.webkit.RetainPtrCtorAdoptChecker] Recognize mutableCopy from literal as +1 (PR #132350)

Ryosuke Niwa via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 15:55:06 PDT 2025


================
@@ -97,3 +97,13 @@ void create_member_init() {
 RetainPtr<id> return_bridge_cast() {
   return bridge_cast<CFArrayRef, NSArray>(create_cf_array());
 }
+
+void mutable_copy() {
+  RetainPtr<NSMutableDictionary> mutableArray = adoptNS(@{
+    @"Content-Type": @"text/html",
+  }.mutableCopy);
+}
+
+void string_copy(NSString *str) {
+  RetainPtr<NSString> copy = adoptNS(str.copy);
+}
----------------
rniwa wrote:

 There is a test case for `RetainPtr<NSMutableDictionary>` right above it. Or are you saying that we should add a test case which takes NSMutableDictionary* as a function argument?

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


More information about the cfe-commits mailing list