diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2022-08-04 15:17:26 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2022-10-24 10:08:49 +0000 |
commit | 72c1c891fa0ee374d0d77c4918617a6968b5fcba (patch) | |
tree | 80bc5334df79e73f196c3a6f312cb55c1f059e03 | |
parent | 2acc90a0ba884230e2a2177763dfb8c3173c61bd (diff) |
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>
-rw-r--r-- | src/plugins/clangcodemodel/clangdsemantichighlighting.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp b/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp index 6714c91b04a..fbddb0b605a 100644 --- a/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp +++ b/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp @@ -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") { |