ClangCodeModel: Fix template highlighting bug

We need to take into account that the ">>" in constructs such as
std::vector<std::pair<int, int>> is only one token on the clang side.

Change-Id: I90f002ca56f236032f6d39c338593a2ff7590061
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-04-15 13:54:02 +02:00
parent 8e8236e9e0
commit c80c724b52
8 changed files with 30 additions and 7 deletions

View File

@@ -1794,6 +1794,13 @@ TEST_F(TokenProcessor, TemplateSeparateDeclDef)
ASSERT_THAT(infos[37], IsHighlightingMark(764u, 5u, 9u, HighlightingType::GlobalVariable));
}
TEST_F(TokenProcessor, NestedTemplate)
{
const auto infos = translationUnit.tokenInfosInRange(sourceRange(773, 44));
ASSERT_THAT(infos[12], HasTwoTypes(HighlightingType::Punctuation,
HighlightingType::DoubleAngleBracketClose));
}
Data *TokenProcessor::d;
void TokenProcessor::SetUpTestCase()