ClangCodeModel: Adapt to new highlighting modifier in clangd

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

Change-Id: I2bcfb09736b6eabc54cd986b0c096c8fa5869b8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-08-04 15:17:26 +02:00
parent 2acc90a0ba
commit 72c1c891fa

View File

@@ -289,10 +289,9 @@ void doSemanticHighlighting(
}
} else if (token.type == "class") {
styles.mainStyle = C_TYPE;
// clang hardly ever differentiates between constructors and the associated class,
// whereas we highlight constructors as functions.
if (ast.isValid()) {
if (token.modifiers.contains("constructorOrDestructor")) {
styles.mainStyle = C_FUNCTION;
} else if (ver < 16 && ast.isValid()) {
const ClangdAstPath path = getAstPath(ast, tokenRange(token));
if (!path.isEmpty()) {
if (path.last().kind() == "CXXConstructor") {