[clang-tools-extra] Add support for renaming objc methods, even those with multiple selector pieces (PR #76466)

Alex Hoppen via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 09:57:13 PST 2024


================
@@ -569,8 +840,13 @@ renameWithinFile(ParsedAST &AST, const NamedDecl &RenameDecl,
     //   }
     if (!isInsideMainFile(RenameLoc, SM))
       continue;
+    Locs.push_back(RenameLoc);
+  }
+  if (const auto *MD = dyn_cast<ObjCMethodDecl>(&RenameDecl))
+    return renameObjCMethodWithinFile(AST, MD, NewName, std::move(Locs));
----------------
ahoppen wrote:

If it is a zero-arg or one-arg Objective-C selector, I think we can still use the old, faster path that doesn’t need to scan the source file for Objective-C selectors using `renameObjCMethodWithinFile`.

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


More information about the cfe-commits mailing list