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

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 00:57:58 PDT 2019


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:157
+    if (canHighlightName(E->getName()))
+      addToken(E->getNameLoc(), HighlightingKind::DependentName);
+    return true;
----------------
Could we highlighting based on the kinds of `E->decls()`? If they're all the same, you could just use the corresponding highlighting kind.
Most of the time ADL at template instantiation time does not affect the resulting highlighting, so we could just assume it's going to stay the same.

If there are no `decls()` or some of them have different highlighting kinds (e.g. static and non-static member functions), you could fallback to `DependentName`.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:162
+  bool VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
+    if (canHighlightName(E->getName()))
+      addToken(E->getNameLoc(), HighlightingKind::DependentName);
----------------
Same here. Could we try guessing the highlighting type based on `E->decls()`?


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