[all-commits] [llvm/llvm-project] 5cdb90: [clangd] Unify printing policy for type hints

zyn0217 via All-commits all-commits at lists.llvm.org
Tue Jun 13 06:31:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5cdb906f1e4093600f99aab8660e1536514a57e8
      https://github.com/llvm/llvm-project/commit/5cdb906f1e4093600f99aab8660e1536514a57e8
  Author: Younan Zhang <zyn7109 at gmail.com>
  Date:   2023-06-13 (Tue, 13 Jun 2023)

  Changed paths:
    M clang-tools-extra/clangd/InlayHints.cpp
    M clang-tools-extra/clangd/unittests/InlayHintTests.cpp

  Log Message:
  -----------
  [clangd] Unify printing policy for type hints

(This patch addresses the comment from https://reviews.llvm.org/D151785#4402460.)

Previously, we used a special printing policy that enabled `PrintCanonicalTypes`
to print type hints for structure bindings. This was intended to
eliminate type aliases like `tuple_element::type`. However, this also
caused TypePrinter to print default template arguments, which could
result in losing the ability to see types like `std::basic_string<char>`
if the fully expanded template-id exceeded the default inlay hint threshold.

Simply getting the canonical type at the call site could help us get rid of
the side effect.

This also merges overloaded `addTypeHint` into one function without
`PrintingPolicy`.

Reviewed By: nridge

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




More information about the All-commits mailing list