[clang-tools-extra] [clangd] Fix renaming single argument ObjC methods (PR #82396)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 22 05:48:14 PST 2024


================
@@ -811,8 +811,14 @@ renameWithinFile(ParsedAST &AST, const NamedDecl &RenameDecl,
       continue;
     Locs.push_back(RenameLoc);
   }
-  if (const auto *MD = dyn_cast<ObjCMethodDecl>(&RenameDecl))
-    return renameObjCMethodWithinFile(AST, MD, NewName, std::move(Locs));
+  if (const auto *MD = dyn_cast<ObjCMethodDecl>(&RenameDecl)) {
+    if (MD->getSelector().getNumArgs() > 1)
----------------
kadircet wrote:

can you give some context into why?

commit message just says what the code does, not why either, so it's not obvious to me what's broken and how it's fixed with this change.

i can see how `zero` arg selectors don't work through the logic you have, because we expect `foo:` and there's never a `:`, but I don't see what's broken with single-arg selectors (and I guess we're having the following consume_back, solely to force single-arg selector case work through C++ rename?)

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


More information about the cfe-commits mailing list