[PATCH] D67901: [clangd] Improve semantic highlighting in dependent contexts (fixes #154)

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 1 16:49:06 PDT 2019


nridge added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:219
+  bool VisitDependentNameTypeLoc(DependentNameTypeLoc L) {
+    addToken(L.getNameLoc(), HighlightingKind::DependentType);
+    return true;
----------------
hokein wrote:
> nit: we have `kindForType` for hanlding all types, so I'd move the logic of detecting the dependent type there.
I did try this, but it doesn't quite work, because `VisitTypeLoc` adds the highlighting to the `TypeLoc`'s `getBeginLoc()`. For something like `typename T::type`, that highlights the `typename` token rather than the `type` token. By contrast, here I add the highlighting to the `DependentNameTypeLoc`'s `getNameLoc()` which will correctly highlight the `type` token.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67901





More information about the cfe-commits mailing list