[PATCH] D150685: [clangd] Renaming: Treat member functions like other functions

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 22 02:40:28 PDT 2023


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:519
+    if (RenameDecl.getKind() != Decl::Function &&
+        RenameDecl.getKind() != Decl::CXXMethod) {
       if (auto *Conflict = lookupSiblingWithName(ASTCtx, RenameDecl, NewName))
----------------
ckandeler wrote:
> hokein wrote:
> > The change looks good. It would be nice to have a testcase, can you add one in the `RenameTest, Renameable` unit test?
> For a function, the rename result ends up in LocalChanges (because there is no index), whereas the test assumes they are in GlobalChanges. Should I adapt the test code accordingly or is it not the right one for this case?
I see, you're right, sorry for missing this bit.

I think it makes sense to change the `RenameTest.Renamable` to use `LocalChanges` (comparing ranges should be enough), as all testcases there are a single file.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150685/new/

https://reviews.llvm.org/D150685



More information about the cfe-commits mailing list