sammccall added inline comments.

Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:38
+  bool VisitNamedDecl(NamedDecl *ND) {
+    if (ND->getDeclName().isEmpty())
+      // Don't add symbols that don't have any length.
I think you might want to bail out (both here and in VisitDeclRefExpr) if the 
name kind isn't identifier.

Reason is you're only coloring the token at location, and most of the other 
name kinds can span multiple tokens or otherwise need special consideration.

Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:61
+    }
+    if(isa<FunctionDecl>(D)) {
+      addToken(Loc, HighlightingKind::Function);
note that methods, constructors, and destructors inherit from functiondecl, so 
if you want to exclude/distinguish those, order matters here

  rG LLVM Github Monorepo


cfe-commits mailing list

Reply via email to