[PATCH] D69506: [clangd] Add missing highlights for using decls.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 28 08:51:11 PDT 2019


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:51
   }
+  if (auto *UD = dyn_cast<UsingDecl>(D)) {
+    if (UD->shadow_size() == 0)
----------------
ilya-biryukov wrote:
> Could we reuse `kindForCandidateDecls` instead?
> It's best to keep one way to highlight multiple decls.
Yes, but note that we need to handle the `UsingShadowDecl` in this function.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:60
+    });
+    return kindForDecl(Selected->getTargetDecl());
+  }
----------------
ilya-biryukov wrote:
> Using decls never have any references and we only highlight them at their declarations locations.
> Therefore `kindForDecl` seems like the wrong place for it. Could we add a `VisitUsingDecl` method to the visitor and have this logic there instead?
good point. done. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69506





More information about the cfe-commits mailing list