forked from qt-creator/qt-creator
ClangCodeModel: Fix build with MSVC 2022
Change-Id: Ifd0e1e67057e57e4c978784e9634f987edb9dfe4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -2461,7 +2461,7 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
|
||||
return Range(startPos, endPos);
|
||||
};
|
||||
const auto isOutputParameter = [&ast, &doc, &tokenRange](const ExpandedSemanticToken &token) {
|
||||
if (token.modifiers.contains("usedAsMutableReference"))
|
||||
if (token.modifiers.contains(QLatin1String("usedAsMutableReference")))
|
||||
return true;
|
||||
if (token.type != "variable" && token.type != "property" && token.type != "parameter")
|
||||
return false;
|
||||
@@ -2515,16 +2515,17 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
|
||||
(const ExpandedSemanticToken &token) {
|
||||
TextStyles styles;
|
||||
if (token.type == "variable") {
|
||||
if (token.modifiers.contains("functionScope")) {
|
||||
if (token.modifiers.contains(QLatin1String("functionScope"))) {
|
||||
styles.mainStyle = C_LOCAL;
|
||||
} else if (token.modifiers.contains("classScope")) {
|
||||
} else if (token.modifiers.contains(QLatin1String("classScope"))) {
|
||||
styles.mainStyle = C_FIELD;
|
||||
} else if (token.modifiers.contains("fileScope")
|
||||
|| token.modifiers.contains("globalScope")) {
|
||||
} else if (token.modifiers.contains(QLatin1String("fileScope"))
|
||||
|| token.modifiers.contains(QLatin1String("globalScope"))) {
|
||||
styles.mainStyle = C_GLOBAL;
|
||||
}
|
||||
} else if (token.type == "function" || token.type == "method") {
|
||||
styles.mainStyle = token.modifiers.contains("virtual") ? C_VIRTUAL_METHOD : C_FUNCTION;
|
||||
styles.mainStyle = token.modifiers.contains(QLatin1String("virtual"))
|
||||
? C_VIRTUAL_METHOD : C_FUNCTION;
|
||||
if (ast.isValid()) {
|
||||
const QList<AstNode> path = getAstPath(ast, tokenRange(token));
|
||||
if (path.length() > 1) {
|
||||
@@ -2582,11 +2583,12 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
|
||||
} 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.
|
||||
styles.mainStyle = token.modifiers.contains("readonly") ? C_PARAMETER : C_TYPE;
|
||||
styles.mainStyle = token.modifiers.contains(QLatin1String("readonly"))
|
||||
? C_PARAMETER : C_TYPE;
|
||||
}
|
||||
if (token.modifiers.contains("declaration"))
|
||||
if (token.modifiers.contains(QLatin1String("declaration")))
|
||||
styles.mixinStyles.push_back(C_DECLARATION);
|
||||
if (token.modifiers.contains("static"))
|
||||
if (token.modifiers.contains(QLatin1String("static")))
|
||||
styles.mixinStyles.push_back(C_STATIC_MEMBER);
|
||||
if (isOutputParameter(token))
|
||||
styles.mixinStyles.push_back(C_OUTPUT_ARGUMENT);
|
||||
|
||||
Reference in New Issue
Block a user