[PATCH] D72071: [clangd] Add correctness checks for index-based rename

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 2 02:34:49 PST 2020


kbobyrev created this revision.
kbobyrev added a reviewer: kadircet.
Herald added subscribers: cfe-commits, usaxena95, arphaman, jkorous, MaskRay.
Herald added a project: clang.

In some cases the candidate ranges for rename final stage (textual
replacements) are invalid and do not contain references to identifier being
renamed. Examples of such behavior include implicit references that are
currently not filtered out (though in the future they should be dealt with
during the references collection stage).

This patch addresses this issue by explicitly checking whether the text in each
candidate range is equivalent to the renamed identifier's name. It does not make
index-based rename absolutely correct, but it is a cheap way to filter out some
replacements that are clearly incorrect.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72071

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/refactor/Rename.h
  clang-tools-extra/clangd/unittests/RenameTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72071.235839.patch
Type: text/x-patch
Size: 5255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200102/c27394ab/attachment.bin>


More information about the cfe-commits mailing list