[clang-tools-extra] feat: highlight for import, export keyword of CXX Module (PR #204511)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 22 03:13:59 PDT 2026


================
@@ -582,36 +582,49 @@ class CollectExtraHighlightings
     return true;
   }
 
-  bool VisitTagDecl(TagDecl *D) {
-    for (TemplateParameterList *TPL : D->getTemplateParameterLists())
-      H.addAngleBracketTokens(TPL->getLAngleLoc(), TPL->getRAngleLoc());
+  bool VisitImportDecl(const ImportDecl *D) {
+    H.addToken(D->getLocation(), HighlightingKind::Keyword);
----------------
HighCommander4 wrote:

We have an existing case of producing a semantic token for context-sensitive keywords: the `override` and `final` keywords, [here](https://searchfox.org/llvm/rev/e0cc08dc1121126392df2b832ee060a60cca6dc3/clang-tools-extra/clangd/SemanticHighlighting.cpp#961-963).

In that case, the token kind we use is `HighlightingKind::Modifier`. Would it make sense to reuse that here?

https://github.com/llvm/llvm-project/pull/204511


More information about the cfe-commits mailing list