From 918c7ca52ddbb446cb4af9bac1ee017fed85b738 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 14 Nov 2022 15:12:48 +0100 Subject: [PATCH] ClangCodeModel: Make use of new clangd token type "modifier" See https://reviews.llvm.org/D137943. Change-Id: I313576b32fff1c9ba44e3753e3f02cdd34e2ea3e Reviewed-by: Qt CI Bot Reviewed-by: Reviewed-by: David Schulz --- src/plugins/clangcodemodel/clangdsemantichighlighting.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp b/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp index 322a21058ff..bed64759c0a 100644 --- a/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp +++ b/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp @@ -331,6 +331,8 @@ void doSemanticHighlighting( styles.mainStyle = C_MACRO; } else if (token.type == "type") { styles.mainStyle = C_TYPE; + } else if (token.type == "modifier") { + styles.mainStyle = C_KEYWORD; } else if (token.type == "typeParameter") { // clangd reports both type and non-type template parameters as type parameters, // but the latter can be distinguished by the readonly modifier. @@ -578,7 +580,8 @@ void ExtraHighlightingResultsCollector::collectFromNode(const ClangdAstNode &nod insertResult(node, C_PRIMITIVE_TYPE); return; } - if (node.role() == "attribute" && (node.kind() == "Override" || node.kind() == "Final")) { + if (m_clangdVersion < 16 && node.role() == "attribute" + && (node.kind() == "Override" || node.kind() == "Final")) { insertResult(node, C_KEYWORD); return; }