[PATCH] D72498: [clangd] Print underlying type for decltypes in hover

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 06:07:58 PST 2020


ilya-biryukov added a comment.

In D72498#1813963 <https://reviews.llvm.org/D72498#1813963>, @kadircet wrote:

> I think typedef and decltype have different nature, the latter is a lot more obscure than the former, that was the reason why I handled decltypes specifically.


I tend to disagree here. `decltype` is normally the last resort, so whatever it produces is probably super-obscure, would even expect it to be not representable in C++ in many cases.
E.g.

  auto Callback = []() { ... };
  decltype(Callback) ^a = Callback;

Typedefs are often used with simple types, so that's not necessarily the case.

  typedef unordered_map<int, int> IntMap;
  IntMap ^a =;



> I agree with your suggestion for typedefs though, I think there would be value in displaying the underlying type in hover card for type aliases to reduce navigation.

Would definitely be helpful. If you feel we have some room in hover, I would love to have that. But there's a balance to be made, see Sam's comments about canonical types being obscure. I agree on 50% of the cases :-)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72498/new/

https://reviews.llvm.org/D72498





More information about the cfe-commits mailing list