ClangCodeModel: Make use of clangd's new "definition" modifier

See https://reviews.llvm.org/D127403.

Change-Id: I791b2396266810bfb3610a9f37565e4f01d67879
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-06-09 10:49:37 +02:00
parent 1c51dc1adf
commit 0759f55c00

View File

@@ -260,7 +260,7 @@ void doSemanticHighlighting(
};
const std::function<HighlightingResult(const ExpandedSemanticToken &)> 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);