[PATCH] D71597: [clangd][NFC] Make use of TagDecl inside type for hover on auto

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 17 06:42:16 PST 2019


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/Hover.cpp:353
 
-  if (D) {
+  if (const auto *D = T->getAsTagDecl()) {
     HI.Kind = index::getSymbolInfo(D).Kind;
----------------
This might be a functional change in case of typedefs.

Could you check on these cases (not sure if we already have those in the tests):
```
typedef int int_type;
^auto x = int_type();

struct cls {};
typedef cls cls_type;
^auto y = cls_type();

template <class>
struct templ {};
^auto z = templ<int>();
```

Note that I don't necessarily think they **will** change behavior, but they **might**.

Also happy to LGTM as is if you remove "NFC" from the description. It seems we're potentially changing behvior, but it's not tested currently and we can land this, discover and fix any regreessions later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71597





More information about the cfe-commits mailing list