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

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 05:41:45 PST 2024


================
@@ -681,12 +957,22 @@ renameOutsideFile(const NamedDecl &RenameDecl, llvm::StringRef MainFilePath,
            ExpBuffer.getError().message());
       continue;
     }
+    std::string RenameIdentifier = RenameDecl.getNameAsString();
+    std::optional<Selector> Selector = std::nullopt;
+    llvm::SmallVector<llvm::StringRef, 8> NewNames;
+    if (const auto *MD = dyn_cast<ObjCMethodDecl>(&RenameDecl)) {
----------------
kadircet wrote:

can we just push this logic all the way into `collectRenameIdentifierRanges`?

it already performs a different logic when we have a selector set, we can just tart by setting `Identifier = Selector.getNameForSlot(0)`

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


More information about the cfe-commits mailing list