[PATCH] D64741: [clangd] Added highlighting for tokens that are macro arguments.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 16 02:31:04 PDT 2019


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:164
+    if(Loc.isMacroID()) {
+      // If the location is not an argument it might be from a macro of the form
+      // "#define VAR var". In that case this would highlight "var" in the macro
----------------
It'd be clearer for the comment to describe which cases we are going to highlight (rather than the cases we don't).


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:170
+        return;
+      Loc = SM.getSpellingLoc(Loc);
+    }
----------------
The Loc here maybe not in the main file, considering the case

```
// in .h
#define DEFINE(X) in X;
#define DEFINE_Y DEFINE(Y)

// in .cc

DEFINE_Y
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64741





More information about the cfe-commits mailing list