This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Enhance Clangd rename testing coverage
ClosedPublic

Authored by kbobyrev on Nov 9 2020, 1:32 PM.

Details

Summary

We plan to eliminate error-prone and obsolete Clang-Rename API from Clangd. To
do that, we will introduce Decl canonicalization rules that will make renaming
code simpler and easier to maintain (D71880).

To ensure smooth transition to the new implementation, many Clang-Rename tests
will be adopted in Clangd to prevent any possible regressions. This patch is
the first in the chain of test migration patches. It improves existing tests
and adopts tests from Clang-Rename's alias, class and enum testing files.

Diff Detail

Event Timeline

kbobyrev created this revision.Nov 9 2020, 1:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 9 2020, 1:32 PM
kbobyrev requested review of this revision.Nov 9 2020, 1:32 PM
kbobyrev updated this revision to Diff 303980.Nov 9 2020, 1:35 PM

Move NewName constant to class field.

thanks for doing this!

clang-tools-extra/clangd/unittests/RenameTests.cpp
611

I'm not sure about the motivation of having a separated TEST_F, are these tests special? These tests are similar to the tests in TEST(RenameTest, WithinFileRename), I wonder why not just adding these tests there?

616

nit: I think this case is already covered in MemberExpr in macros above.

638

IIUC, it tests constructor initializer? looks like it is covered in CXXConstructor initializer list.

kbobyrev updated this revision to Diff 304071.Nov 10 2020, 12:38 AM
kbobyrev marked 3 inline comments as done.

Resolve comments. Since member tests seem to be covered already, add enum and
alias tests.

hokein accepted this revision.Nov 10 2020, 12:53 AM

Thanks. Please update the patch description when landing it (the description is stale now).

clang-tools-extra/clangd/unittests/RenameTests.cpp
95

nit: keep this comment.

537

nit: put this case around Class methods overrides.

545

while we have a group of alias tests, worth to move the Namespace alias to here.

This revision is now accepted and ready to land.Nov 10 2020, 12:53 AM
kbobyrev updated this revision to Diff 304076.Nov 10 2020, 12:58 AM

Also add class tests.

kbobyrev updated this revision to Diff 304077.Nov 10 2020, 1:01 AM
kbobyrev marked 3 inline comments as done.

Resolve comments.

kbobyrev edited the summary of this revision. (Show Details)Nov 10 2020, 1:03 AM
This revision was landed with ongoing or failed builds.Nov 10 2020, 1:09 AM
This revision was automatically updated to reflect the committed changes.