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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 18 04:21:21 PDT 2022


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:546
+  bool VisitPredefinedExpr(PredefinedExpr *E) {
+    H.addToken(E->getLocation(), HighlightingKind::Macro);
+    return true;
----------------
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.


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