Clang: Make file ids unique

Clang file ids are only unique for one query. Because we query in parallel
we have to manage our own unique ids.

Change-Id: I67d57d8b1766cab75ad252a14e57bbf9dc5fdb79
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen
2017-07-03 11:12:00 +02:00
parent 35ca318d18
commit dae4477cd3
27 changed files with 231 additions and 159 deletions

View File

@@ -29,10 +29,12 @@
namespace ClangBackEnd {
ClangQueryGatherer::ClangQueryGatherer(std::vector<V2::FileContainer> &&sources,
ClangQueryGatherer::ClangQueryGatherer(StringCache<Utils::PathString, std::mutex> *filePathCache,
std::vector<V2::FileContainer> &&sources,
std::vector<V2::FileContainer> &&unsaved,
Utils::SmallString &&query)
: m_sources(std::move(sources)),
: m_filePathCache(filePathCache),
m_sources(std::move(sources)),
m_unsaved(std::move(unsaved)),
m_query(std::move(query))
{
@@ -40,11 +42,12 @@ ClangQueryGatherer::ClangQueryGatherer(std::vector<V2::FileContainer> &&sources,
SourceRangesAndDiagnosticsForQueryMessage
ClangQueryGatherer::createSourceRangesAndDiagnosticsForSource(
StringCache<Utils::PathString, std::mutex> *filePathCache,
V2::FileContainer &&source,
const std::vector<V2::FileContainer> &unsaved,
Utils::SmallString &&query)
{
ClangQuery clangQuery(std::move(query));
ClangQuery clangQuery(*filePathCache, std::move(query));
clangQuery.addFile(source.filePath().directory(),
source.filePath().name(),
@@ -65,7 +68,8 @@ bool ClangQueryGatherer::canCreateSourceRangesAndDiagnostics() const
SourceRangesAndDiagnosticsForQueryMessage ClangQueryGatherer::createNextSourceRangesAndDiagnostics()
{
auto message = createSourceRangesAndDiagnosticsForSource(std::move(m_sources.back()),
auto message = createSourceRangesAndDiagnosticsForSource(m_filePathCache,
std::move(m_sources.back()),
m_unsaved,
m_query.clone());
m_sources.pop_back();
@@ -77,6 +81,7 @@ ClangQueryGatherer::Future ClangQueryGatherer::startCreateNextSourceRangesAndDia
{
Future future = std::async(std::launch::async,
createSourceRangesAndDiagnosticsForSource,
m_filePathCache,
std::move(m_sources.back()),
m_unsaved,
m_query.clone());