[clangd] Fix non-idempotent cases of canonicalRenameDecl()
authorSam McCall <sam.mccall@gmail.com>
Wed, 7 Sep 2022 11:30:08 +0000 (13:30 +0200)
committerSam McCall <sam.mccall@gmail.com>
Wed, 5 Oct 2022 19:22:08 +0000 (21:22 +0200)
commit5f7f4846e826f97c7f298fe419c958398d5a0386
treef52caa0b1efae3dfa7cbd9a8186b2626fed5f557
parente99e8ad24da902bd34902e6e83b6e71e255bf868
[clangd] Fix non-idempotent cases of canonicalRenameDecl()

The simplest way to ensure full canonicalization is to canonicalize
recursively in most cases.

This fixes an assertion failure and presumably correctness bugs.

It does show up that D132797's index-based virtual method renames doesn't handle
templates well (the AST behavior is different and IMO better).
We could choose to disable in this case or change the index behavior,
but this patch doesn't do either.

Differential Revision: https://reviews.llvm.org/D133415
clang-tools-extra/clangd/refactor/Rename.cpp
clang-tools-extra/clangd/unittests/RenameTests.cpp