[all-commits] [llvm/llvm-project] f0004a: [clangd] Deduplicate refs from index for cross-fil...

Haojian Wu via All-commits all-commits at lists.llvm.org
Wed Dec 11 01:52:22 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f0004aad5565d4b76d41a03549c5a80efc4212c7
      https://github.com/llvm/llvm-project/commit/f0004aad5565d4b76d41a03549c5a80efc4212c7
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2019-12-11 (Wed, 11 Dec 2019)

  Changed paths:
    M clang-tools-extra/clangd/refactor/Rename.cpp
    M clang-tools-extra/clangd/refactor/Rename.h
    M clang-tools-extra/clangd/unittests/RenameTests.cpp

  Log Message:
  -----------
  [clangd] Deduplicate refs from index for cross-file rename.

Summary:
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.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, mgrang, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71300




More information about the All-commits mailing list