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