ckandeler updated this revision to Diff 524206. ckandeler added a comment. Formatting glitch.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150685/new/ https://reviews.llvm.org/D150685 Files: clang-tools-extra/clangd/refactor/Rename.cpp clang-tools-extra/clangd/unittests/RenameTests.cpp Index: clang-tools-extra/clangd/unittests/RenameTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/RenameTests.cpp +++ clang-tools-extra/clangd/unittests/RenameTests.cpp @@ -1062,6 +1062,19 @@ )cpp", "conflict", !HeaderFile, "Conflict"}, + {R"cpp( + void func(int); + void [[o^therFunc]](double); + )cpp", + nullptr, !HeaderFile, "func"}, + {R"cpp( + struct S { + void func(int); + void [[o^therFunc]](double); + }; + )cpp", + nullptr, !HeaderFile, "func"}, + {R"cpp( int V^ar; )cpp", @@ -1121,9 +1134,7 @@ } else { EXPECT_TRUE(bool(Results)) << "rename returned an error: " << llvm::toString(Results.takeError()); - ASSERT_EQ(1u, Results->GlobalChanges.size()); - EXPECT_EQ(applyEdits(std::move(Results->GlobalChanges)).front().second, - expectedResult(T, NewName)); + EXPECT_EQ(Results->LocalChanges, T.ranges()); } } } Index: clang-tools-extra/clangd/refactor/Rename.cpp =================================================================== --- clang-tools-extra/clangd/refactor/Rename.cpp +++ clang-tools-extra/clangd/refactor/Rename.cpp @@ -515,7 +515,8 @@ else { // Name conflict detection. // Function conflicts are subtle (overloading), so ignore them. - if (RenameDecl.getKind() != Decl::Function) { + if (RenameDecl.getKind() != Decl::Function && + RenameDecl.getKind() != Decl::CXXMethod) { if (auto *Conflict = lookupSiblingWithName(ASTCtx, RenameDecl, NewName)) Result = InvalidName{ InvalidName::Conflict,
Index: clang-tools-extra/clangd/unittests/RenameTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/RenameTests.cpp +++ clang-tools-extra/clangd/unittests/RenameTests.cpp @@ -1062,6 +1062,19 @@ )cpp", "conflict", !HeaderFile, "Conflict"}, + {R"cpp( + void func(int); + void [[o^therFunc]](double); + )cpp", + nullptr, !HeaderFile, "func"}, + {R"cpp( + struct S { + void func(int); + void [[o^therFunc]](double); + }; + )cpp", + nullptr, !HeaderFile, "func"}, + {R"cpp( int V^ar; )cpp", @@ -1121,9 +1134,7 @@ } else { EXPECT_TRUE(bool(Results)) << "rename returned an error: " << llvm::toString(Results.takeError()); - ASSERT_EQ(1u, Results->GlobalChanges.size()); - EXPECT_EQ(applyEdits(std::move(Results->GlobalChanges)).front().second, - expectedResult(T, NewName)); + EXPECT_EQ(Results->LocalChanges, T.ranges()); } } } Index: clang-tools-extra/clangd/refactor/Rename.cpp =================================================================== --- clang-tools-extra/clangd/refactor/Rename.cpp +++ clang-tools-extra/clangd/refactor/Rename.cpp @@ -515,7 +515,8 @@ else { // Name conflict detection. // Function conflicts are subtle (overloading), so ignore them. - if (RenameDecl.getKind() != Decl::Function) { + if (RenameDecl.getKind() != Decl::Function && + RenameDecl.getKind() != Decl::CXXMethod) { if (auto *Conflict = lookupSiblingWithName(ASTCtx, RenameDecl, NewName)) Result = InvalidName{ InvalidName::Conflict,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits