clangbackend: Fix highlighting for #include directives

These were falsely categorized as string literals. No one ever noticed,
because highlighting information for string literals was ignored until
baf25e4cdb.

Change-Id: Ib59fde04359aecb6da3995de1a9febbbf41b12c8
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2020-10-30 12:28:37 +01:00
parent 76ae5780c4
commit e35dfd592f
2 changed files with 7 additions and 2 deletions

View File

@@ -928,7 +928,8 @@ TEST_F(TokenProcessor, PreprocessorInclusionDirective)
{
const auto infos = translationUnit.tokenInfosInRange(sourceRange(239, 18));
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::StringLiteral));
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Preprocessor));
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::StringLiteral));
}
TEST_F(TokenProcessor, GotoLabelStatement)
@@ -1080,6 +1081,7 @@ TEST_F(TokenProcessor, PreprocessorInclusionDirectiveWithAngleBrackets )
{
const auto infos = translationUnit.tokenInfosInRange(sourceRange(289, 38));
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Preprocessor));
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::StringLiteral));
}