Clang: Optimize clang overview model

Build the tree in only one loop.

clangbackend generates tokens almost as fast as it
did before (about 10% slower in general).
Broken documents are more affected and take much more
time (about 300%) but it's better to have this time spent
on backend side then in QtC itself.

Task-number: QTCREATORBUG-20205
Change-Id: I34c58bca30c4494005a029abd82c7e612ecd6fb9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-04-06 14:24:28 +02:00
parent 5de5794c49
commit f9d95c9205
6 changed files with 114 additions and 81 deletions

View File

@@ -1354,6 +1354,14 @@ TEST_F(TokenProcessor, AnonymousStruct)
ASSERT_THAT(container.types.mixinHighlightingTypes[0], ClangBackEnd::HighlightingType::Struct);
}
TEST_F(TokenProcessor, LexicalParentIndex)
{
const auto containers = translationUnit.fullTokenInfosInRange(
translationUnit.sourceRange(50, 1, 53, 3)).toTokenInfoContainers();
ASSERT_THAT(containers[3].extraInfo.lexicalParentIndex, 1);
}
Data *TokenProcessor::d;
void TokenProcessor::SetUpTestCase()