forked from qt-creator/qt-creator
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:
@@ -260,7 +260,7 @@ void doSemanticHighlighting(
|
|||||||
};
|
};
|
||||||
|
|
||||||
const std::function<HighlightingResult(const ExpandedSemanticToken &)> toResult
|
const std::function<HighlightingResult(const ExpandedSemanticToken &)> toResult
|
||||||
= [&ast, &isOutputParameter, &tokenRange]
|
= [&ast, &isOutputParameter, &tokenRange, ver = clangdVersion.majorVersion()]
|
||||||
(const ExpandedSemanticToken &token) {
|
(const ExpandedSemanticToken &token) {
|
||||||
TextStyles styles;
|
TextStyles styles;
|
||||||
if (token.type == "variable") {
|
if (token.type == "variable") {
|
||||||
@@ -275,7 +275,9 @@ void doSemanticHighlighting(
|
|||||||
} else if (token.type == "function" || token.type == "method") {
|
} else if (token.type == "function" || token.type == "method") {
|
||||||
styles.mainStyle = token.modifiers.contains(QLatin1String("virtual"))
|
styles.mainStyle = token.modifiers.contains(QLatin1String("virtual"))
|
||||||
? C_VIRTUAL_METHOD : C_FUNCTION;
|
? 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));
|
const ClangdAstPath path = getAstPath(ast, tokenRange(token));
|
||||||
if (path.length() > 1) {
|
if (path.length() > 1) {
|
||||||
const ClangdAstNode declNode = path.at(path.length() - 2);
|
const ClangdAstNode declNode = path.at(path.length() - 2);
|
||||||
|
Reference in New Issue
Block a user