Clang: Use current TranslationUnit follow symbol based on clang code model

It might be quite a safe replacement which can fix builtin
code model issues.

If clang code model fails to follow symbol or does not find
a definition when it's required we fall back to the built-in
code model to proceed with project-wide follow symbol.

To make it almost a full replacement tweak include paths underline
on cursor hover to match what we have in built-in code model.

SIGNAL/SLOTS macros are not yet supported but can be handled
in follow up patch.

Task-number: QTCREATORBUG-19477
Change-Id: Id1611511d661a8aaf3e93502b4e03e1792c7c1d3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-01-05 10:50:37 +01:00
parent 388713df12
commit 7b2774dea1
5 changed files with 79 additions and 25 deletions

View File

@@ -92,6 +92,17 @@ MATCHER_P5(HasDirtyDocument,
}
}
MATCHER_P(PartlyContains, token, "")
{
for (const auto &item: arg) {
if (item.types == token.types && item.line == token.line && item.column == token.column
&& item.length == token.length) {
return true;
}
}
return false;
}
static constexpr int AnnotationJobsMultiplier = 2;
class ClangCodeModelServer : public ::testing::Test
@@ -675,7 +686,7 @@ void ClangCodeModelServer::expectDocumentAnnotationsChangedForFileBWithSpecificH
EXPECT_CALL(mockClangCodeModelClient,
documentAnnotationsChanged(
Field(&DocumentAnnotationsChangedMessage::tokenInfos,
Contains(tokenInfo))));
PartlyContains(tokenInfo)))).Times(AnnotationJobsMultiplier);
}
void ClangCodeModelServer::updateUnsavedContent(const Utf8String &filePath,