From 4b3c0ffc03031b433a70dbaef93a4134793aa8f5 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 23 May 2017 15:25:36 +0200 Subject: [PATCH] Clang: Fix highlighting of operators (==, <<, ..) Handle all enum values that can be reported for clang highlighting marks. Change-Id: I07eec789902f36d70fa15f26cad0b151e2adff6e Reviewed-by: Nikolai Kosjar --- .../clanghighlightingmarksreporter.cpp | 70 +++++++++++-------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/src/plugins/clangcodemodel/clanghighlightingmarksreporter.cpp b/src/plugins/clangcodemodel/clanghighlightingmarksreporter.cpp index 2a048fc26de..6090b73f415 100644 --- a/src/plugins/clangcodemodel/clanghighlightingmarksreporter.cpp +++ b/src/plugins/clangcodemodel/clanghighlightingmarksreporter.cpp @@ -26,6 +26,7 @@ #include "clanghighlightingmarksreporter.h" #include +#include #include @@ -36,36 +37,45 @@ TextEditor::TextStyle toTextStyle(ClangBackEnd::HighlightingType type) using ClangBackEnd::HighlightingType; switch (type) { - case HighlightingType::Keyword: - return TextEditor::C_KEYWORD; - case HighlightingType::Function: - return TextEditor::C_FUNCTION; - case HighlightingType::VirtualFunction: - return TextEditor::C_VIRTUAL_METHOD; - case HighlightingType::Type: - return TextEditor::C_TYPE; - case HighlightingType::PrimitiveType: - return TextEditor::C_PRIMITIVE_TYPE; - case HighlightingType::LocalVariable: - return TextEditor::C_LOCAL; - case HighlightingType::Field: - return TextEditor::C_FIELD; - case HighlightingType::GlobalVariable: - return TextEditor::C_GLOBAL; - case HighlightingType::Enumeration: - return TextEditor::C_ENUMERATION; - case HighlightingType::Label: - return TextEditor::C_LABEL; - case HighlightingType::Preprocessor: - case HighlightingType::PreprocessorDefinition: - case HighlightingType::PreprocessorExpansion: - return TextEditor::C_PREPROCESSOR; - case HighlightingType::Declaration: - return TextEditor::C_DECLARATION; - case HighlightingType::OutputArgument: - return TextEditor::C_OUTPUT_ARGUMENT; - default: - return TextEditor::C_TEXT; // never called + case HighlightingType::Keyword: + return TextEditor::C_KEYWORD; + case HighlightingType::Function: + return TextEditor::C_FUNCTION; + case HighlightingType::VirtualFunction: + return TextEditor::C_VIRTUAL_METHOD; + case HighlightingType::Type: + return TextEditor::C_TYPE; + case HighlightingType::PrimitiveType: + return TextEditor::C_PRIMITIVE_TYPE; + case HighlightingType::LocalVariable: + return TextEditor::C_LOCAL; + case HighlightingType::Field: + return TextEditor::C_FIELD; + case HighlightingType::GlobalVariable: + return TextEditor::C_GLOBAL; + case HighlightingType::Enumeration: + return TextEditor::C_ENUMERATION; + case HighlightingType::Label: + return TextEditor::C_LABEL; + case HighlightingType::Preprocessor: + case HighlightingType::PreprocessorDefinition: + case HighlightingType::PreprocessorExpansion: + return TextEditor::C_PREPROCESSOR; + case HighlightingType::Declaration: + return TextEditor::C_DECLARATION; + case HighlightingType::OutputArgument: + return TextEditor::C_OUTPUT_ARGUMENT; + case HighlightingType::Operator: + return TextEditor::C_OPERATOR; + case HighlightingType::Comment: + return TextEditor::C_COMMENT; + case HighlightingType::StringLiteral: + return TextEditor::C_STRING; + case HighlightingType::NumberLiteral: + return TextEditor::C_NUMBER; + case HighlightingType::Invalid: + QTC_CHECK(false); // never called + return TextEditor::C_TEXT; } Q_UNREACHABLE();