[PATCH] D66995: [clangd] Add highlighting for macro expansions.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 30 03:26:54 PDT 2019


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:35
+    TraverseAST(AST.getASTContext());
+    // Add highlightings for Macro Expansions as they are not traversed by the
+    // visitor.
----------------
NIT: uncapitalize and use 'macro expansions' instead of `Macro Expansions'


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:469
+  case HighlightingKind::MacroExpansion:
+    return "entity.name.function.preprocessor.expansion.cpp";
   case HighlightingKind::NumKinds:
----------------
Is there a place on the internet with conventional textmate scope names?
Or do we come up with these on our own?


================
Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:394
       #define DEF_MULTIPLE(X) namespace X { class X { int X; }; }
       #define DEF_CLASS(T) class T {};
+      $MacroExpansion[[DEF_MULTIPLE]](XYZ);
----------------
Similar to how we highlight everything else, we should also highlight macro declarations and usages (i.e. expansions in the same way).
Could we add the corresponding highlightings?
```
#define $Macro[[DEF_CLASS]](T) class T T{}
$Macro[[DEF_CLASS]](A);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66995





More information about the cfe-commits mailing list