summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2019-08-26 16:38:21 +0200
committerMarco Bubke <marco.bubke@qt.io>2019-08-27 11:54:17 +0000
commita46da29125a0525f6c250055c52d479e75f4aa85 (patch)
tree552c92fecbcd568535f46def75cc086395475f2c /src/tools
parent99e841d140d86e8e3dce56292d253b241260050f (diff)
downloadqt-creator-a46da29125a0525f6c250055c52d479e75f4aa85.tar.gz
ClangPchManager: Fix merge in ProjectPartsManager
We relied on the reserve function but this is a little bit brittle. So we create now two container and merge them later. This can be sometimes slower or even faster but anyway I think it does not matter. Change-Id: I78dca39c84cc82de17c1efe0b202b6662734d56d Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/clangpchmanagerbackend/source/projectpartsmanager.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/tools/clangpchmanagerbackend/source/projectpartsmanager.cpp b/src/tools/clangpchmanagerbackend/source/projectpartsmanager.cpp
index 5e8f6fe0ef..307041ed2e 100644
--- a/src/tools/clangpchmanagerbackend/source/projectpartsmanager.cpp
+++ b/src/tools/clangpchmanagerbackend/source/projectpartsmanager.cpp
@@ -132,7 +132,7 @@ ProjectPartsManager::UpToDataProjectParts ProjectPartsManager::update(ProjectPar
}
ProjectPartsManagerInterface::UpToDataProjectParts ProjectPartsManager::checkDependeciesAndTime(
- ProjectPartContainers &&upToDateProjectParts, ProjectPartContainers &&updateSystemProjectParts)
+ ProjectPartContainers &&upToDateProjectParts, ProjectPartContainers &&orignalUpdateSystemProjectParts)
{
ProjectPartContainerReferences changeProjectParts;
changeProjectParts.reserve(upToDateProjectParts.size());
@@ -140,9 +140,8 @@ ProjectPartsManagerInterface::UpToDataProjectParts ProjectPartsManager::checkDep
ProjectPartContainers updateProjectProjectParts;
updateProjectProjectParts.reserve(upToDateProjectParts.size());
- updateSystemProjectParts.reserve(updateProjectProjectParts.size() + upToDateProjectParts.size());
-
- auto systemSplit = updateSystemProjectParts.end();
+ ProjectPartContainers addedUpToDateSystemProjectParts;
+ addedUpToDateSystemProjectParts.reserve(upToDateProjectParts.size());
FilePathIds generatedFiles = m_generatedFiles.filePathIds();
@@ -178,7 +177,7 @@ ProjectPartsManagerInterface::UpToDataProjectParts ProjectPartsManager::checkDep
projectPart.projectPartId = -1;
break;
case Change::System:
- updateSystemProjectParts.emplace_back(std::move(projectPart));
+ addedUpToDateSystemProjectParts.emplace_back(std::move(projectPart));
projectPart.projectPartId = -1;
break;
case Change::No:
@@ -205,7 +204,7 @@ ProjectPartsManagerInterface::UpToDataProjectParts ProjectPartsManager::checkDep
projectPart.projectPartId = -1;
break;
case Change::System:
- updateSystemProjectParts.emplace_back(std::move(projectPart));
+ addedUpToDateSystemProjectParts.emplace_back(std::move(projectPart));
projectPart.projectPartId = -1;
break;
case Change::No:
@@ -234,7 +233,15 @@ ProjectPartsManagerInterface::UpToDataProjectParts ProjectPartsManager::checkDep
if (watchedIdPaths.size())
m_clangPathwatcher.updateIdPaths(watchedIdPaths);
- std::inplace_merge(updateSystemProjectParts.begin(), systemSplit, updateSystemProjectParts.end());
+ ProjectPartContainers updateSystemProjectParts;
+ updateSystemProjectParts.reserve(orignalUpdateSystemProjectParts.size() + addedUpToDateSystemProjectParts.size());
+
+ std::merge(std::make_move_iterator(orignalUpdateSystemProjectParts.begin()),
+ std::make_move_iterator(orignalUpdateSystemProjectParts.end()),
+ std::make_move_iterator(addedUpToDateSystemProjectParts.begin()),
+ std::make_move_iterator(addedUpToDateSystemProjectParts.end()),
+ std::back_inserter(updateSystemProjectParts));
+
upToDateProjectParts.erase(std::remove_if(upToDateProjectParts.begin(),
upToDateProjectParts.end(),
[](const ProjectPartContainer &projectPart) {