[PATCH] D64492: [clangd] Added highlightings for namespace specifiers.

Johan Vikström via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 11 01:03:31 PDT 2019


jvikstrom added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:87
+  bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNSLoc) {
+    if (NestedNameSpecifier *NNS = NNSLoc.getNestedNameSpecifier())
+      if (NNS->getKind() == NestedNameSpecifier::Namespace ||
----------------
sammccall wrote:
> if you're just doing something and then calling base, can you make this Visit instead of Traverse?
NestedNameSpecifierLoc does not have a visit method for some reason. It only has a traverse method and this seems to be the way people get nested namespaces from what I can tell. (Maybe a Visit method is something that should be added to the RecursiveASTVisitor, but I wouldn't do that in this patch).


================
Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:86
       template<typename T>
-      struct $Class[[C]] : abc::A<T> {
+      struct $Class[[C]] : $Namespace[[abc]]::A<T> {
         typename T::A* D;
----------------
sammccall wrote:
> can you add a case where we spell with leading colons e.g. `::abc::A`
Added it in the case that focuses on namespaces further down.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64492





More information about the cfe-commits mailing list