This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Unify printing policy for type hints
ClosedPublic

Authored by zyounan on Jun 9 2023, 4:22 AM.

Details

Summary

(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.

Diff Detail

Event Timeline

zyounan created this revision.Jun 9 2023, 4:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 4:22 AM
zyounan published this revision for review.Jun 9 2023, 4:22 AM
nridge accepted this revision.Jun 13 2023, 12:14 AM

LGTM

This revision is now accepted and ready to land.Jun 13 2023, 12:14 AM
zyounan updated this revision to Diff 530867.Jun 13 2023, 5:14 AM

Rebase onto D151785.

zyounan edited the summary of this revision. (Show Details)Jun 13 2023, 5:14 AM
This revision was landed with ongoing or failed builds.Jun 13 2023, 6:31 AM
This revision was automatically updated to reflect the committed changes.