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

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 23 01:27:44 PST 2024


================
@@ -811,8 +811,17 @@ 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)) {
+    // The custom ObjC selector logic doesn't handle the zero arg selector
+    // case. We could use it for the one arg selector case but it's simpler to
+    // use the standard one-token rename logic.
----------------
kadircet wrote:

```suggestion
    // The custom ObjC selector logic doesn't handle the zero arg selector
    // case, as it relies on parsing selectors via the trailing `:`.
    // We also chose to use regular rename logic for the single-arg selectors
    // as AST/Index has the right locations in that case.
```

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


More information about the cfe-commits mailing list