[all-commits] [llvm/llvm-project] cf39bd: [clangd] Implement Decl canonicalization rules for...

Kirill Bobyrev via All-commits all-commits at lists.llvm.org
Mon Nov 23 02:43:45 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: cf39bdb49086350e7178a0a058273907d180e809
      https://github.com/llvm/llvm-project/commit/cf39bdb49086350e7178a0a058273907d180e809
  Author: Kirill Bobyrev <kbobyrev at google.com>
  Date:   2020-11-23 (Mon, 23 Nov 2020)

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

  Log Message:
  -----------
  [clangd] Implement Decl canonicalization rules for rename

This patch introduces new canonicalization rules which are used for AST-based
rename in Clangd. By comparing two canonical declarations of inspected nodes,
Clangd determines whether both of them belong to the same entity user would
like to rename. Such functionality is relatively concise compared to the
Clang-Rename API that is used right now. It also helps to overcome the
limitations that Clang-Rename originally had and helps to eliminate several
classes of bugs.

Clangd AST-based rename currently relies on Clang-Rename which has design
limitations and also lacks some features. This patch breaks this dependency and
significantly reduces the amount of code to maintain (Clang-Rename is ~2000 LOC,
this patch is just <30 LOC of replacement code).

We eliminate technical debt by simultaneously

* Maintaining feature parity and ensuring no regressions
* Opening a straightforward path to improving existing rename bugs
* Making it possible to add more capabilities to rename feature which would not
  be possible with Clang-Rename

Reviewed By: hokein

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




More information about the All-commits mailing list