summaryrefslogtreecommitdiff
path: root/src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@qt.io>2017-07-03 11:12:00 +0200
committerTim Jenssen <tim.jenssen@qt.io>2017-07-03 09:27:05 +0000
commitdae4477cd367d115e2011cfedae6b1d5dbc22cb7 (patch)
tree5fa0ebf3db5cfe9f946c70e8c82f4bd09fca77db /src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp
parent35ca318d187eb1356f36dce86946f12a530dfd6f (diff)
downloadqt-creator-dae4477cd367d115e2011cfedae6b1d5dbc22cb7.tar.gz
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>
Diffstat (limited to 'src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp')
-rw-r--r--src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp b/src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp
index cbf9a9c70c..09c96a69b5 100644
--- a/src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp
+++ b/src/tools/clangrefactoringbackend/source/clangquerygatherer.cpp
@@ -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());