[PATCH] D93553: [clangd] Make our printing policies for Hover more consistent, especially tags

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 18 09:39:38 PST 2020


sammccall created this revision.
sammccall added a reviewer: qchateau.
Herald added subscribers: usaxena95, kadircet, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

Different cases were using a bunch of different variants of the printing policy.
Each of these had something going for it, but the result was inconsistent.

Goals:

- single printing policy used (almost) everywhere
- avoid unidiomatic tags like `class vector<class X>`
- be informative and easy to understand

For tags, the solution I wound up with is: we print only the outer tag and only
in the simplest cases where this elaboration won't cause confusion.

For example:

- class X
- enum Foo
- vector<int>
- X*

This seems to strike a nice balance of providing plenty of info/context in common
cases while never being confusing.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93553

Files:
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93553.312832.patch
Type: text/x-patch
Size: 14111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201218/637c6896/attachment-0001.bin>


More information about the cfe-commits mailing list