[PATCH] D64199: [clangd] Added highlighting for variable references (declrefs)
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 4 06:56:25 PDT 2019
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
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64199/new/
https://reviews.llvm.org/D64199
More information about the cfe-commits
mailing list