From 0759f55c0024a8a1c882dce9676fa006014ab2e2 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 9 Jun 2022 10:49:37 +0200 Subject: [PATCH] ClangCodeModel: Make use of clangd's new "definition" modifier See https://reviews.llvm.org/D127403. Change-Id: I791b2396266810bfb3610a9f37565e4f01d67879 Reviewed-by: Qt CI Bot Reviewed-by: David Schulz --- src/plugins/clangcodemodel/clangdsemantichighlighting.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp b/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp index dcf6a898993..6714c91b04a 100644 --- a/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp +++ b/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp @@ -260,7 +260,7 @@ void doSemanticHighlighting( }; const std::function toResult - = [&ast, &isOutputParameter, &tokenRange] + = [&ast, &isOutputParameter, &tokenRange, ver = clangdVersion.majorVersion()] (const ExpandedSemanticToken &token) { TextStyles styles; if (token.type == "variable") { @@ -275,7 +275,9 @@ void doSemanticHighlighting( } else if (token.type == "function" || token.type == "method") { styles.mainStyle = token.modifiers.contains(QLatin1String("virtual")) ? C_VIRTUAL_METHOD : C_FUNCTION; - if (ast.isValid()) { + if (token.modifiers.contains("definition")) { + styles.mixinStyles.push_back(C_FUNCTION_DEFINITION); + } else if (ver < 16 && ast.isValid()) { const ClangdAstPath path = getAstPath(ast, tokenRange(token)); if (path.length() > 1) { const ClangdAstNode declNode = path.at(path.length() - 2);