[PATCH] D131175: [clangd] Use the "macro" semantic token for pre-defined identifiers

Christian Kandeler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 18 05:54:44 PDT 2022


ckandeler added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:546
+  bool VisitPredefinedExpr(PredefinedExpr *E) {
+    H.addToken(E->getLocation(), HighlightingKind::Macro);
+    return true;
----------------
sammccall wrote:
> actually, would HighlightingKind::LocalVariable be more appropriate?
> 
> The standard calls this a "The function-local predefined variable".
> 
> Admittedly I have a tendency to think of it as macro-like by analogy with `__LINE__` etc but this model is observably wrong: it breaks down with templates and in other ways.
Hm, yes, I was not aware it was specified explicitly as a local variable. Will change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131175



More information about the cfe-commits mailing list