forked from qt-creator/qt-creator
Clang: Stop highlighting keywords in preprocessor directives
Task-number: QTCREATORBUG-15516 Change-Id: I30046ae7c1a73144985639800227012bf5a4e357 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -383,8 +383,15 @@ HighlightingType HighlightingMark::punctuationKind(const Cursor &cursor)
|
||||
}
|
||||
|
||||
static HighlightingType highlightingTypeForKeyword(CXTranslationUnit cxTranslationUnit,
|
||||
CXToken *cxToken)
|
||||
CXToken *cxToken,
|
||||
const Cursor &cursor)
|
||||
{
|
||||
switch (cursor.kind()) {
|
||||
case CXCursor_PreprocessingDirective: return HighlightingType::Preprocessor;
|
||||
case CXCursor_InclusionDirective: return HighlightingType::StringLiteral;
|
||||
default: break;
|
||||
}
|
||||
|
||||
const ClangString spelling = clang_getTokenSpelling(cxTranslationUnit, *cxToken);
|
||||
const char *c = spelling.cString();
|
||||
if (std::strcmp(c, "bool") == 0
|
||||
@@ -414,7 +421,7 @@ void HighlightingMark::collectKinds(CXTranslationUnit cxTranslationUnit,
|
||||
types = HighlightingTypes();
|
||||
|
||||
switch (cxTokenKind) {
|
||||
case CXToken_Keyword: types.mainHighlightingType = highlightingTypeForKeyword(cxTranslationUnit, cxToken); break;
|
||||
case CXToken_Keyword: types.mainHighlightingType = highlightingTypeForKeyword(cxTranslationUnit, cxToken, originalCursor); break;
|
||||
case CXToken_Punctuation: types.mainHighlightingType = punctuationKind(cursor); break;
|
||||
case CXToken_Identifier: identifierKind(cursor, Recursion::FirstPass); break;
|
||||
case CXToken_Comment: types.mainHighlightingType = HighlightingType::Comment; break;
|
||||
|
||||
Reference in New Issue
Block a user