clangbackend: Fix token length calculation

This was broken for tokens with characters that take up more than one
byte.

Fixes: QTCREATORBUG-25715
Change-Id: Ic9842b960af8d6f12487f582b100cb2edcf48cc1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-05-12 14:49:46 +02:00
parent 0c5427c642
commit 3113b0e6d6
3 changed files with 11 additions and 1 deletions

View File

@@ -1807,6 +1807,12 @@ TEST_F(TokenProcessor, OperatorInTemplate)
ASSERT_THAT(infos[9], HasOnlyType(HighlightingType::Punctuation));
}
TEST_F(TokenProcessor, CyrillicString)
{
const auto infos = translationUnit.tokenInfosInRange(sourceRange(792, 28));
ASSERT_THAT(infos[5], IsHighlightingMark(792u, 24u, 3u, HighlightingType::StringLiteral));
}
Data *TokenProcessor::d;
void TokenProcessor::SetUpTestCase()