[PATCH] D71300: [clangd] Deduplicate refs from index for cross-file rename.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 10 13:42:15 PST 2019


hokein created this revision.
hokein added a reviewer: ilya-biryukov.
Herald added subscribers: usaxena95, kadircet, arphaman, mgrang, jkorous, MaskRay.
Herald added a project: clang.

If the index returns duplicated refs, it will trigger the assertion in
BuildRenameEdit (we expect the processing position is always larger the
the previous one, but it is not true if we have duplication), and also
breaks our heuristics.

This patch make the code robost enough to handle duplications, also
save some cost of redundnat llvm::sort.

Though clangd's index doesn't return duplications, our internal index
kythe will.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71300

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: D71300.233185.patch
Type: text/x-patch
Size: 6601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191210/e59b96cd/attachment.bin>


More information about the cfe-commits mailing list