summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-18 20:24:11 (GMT)
committerBrad King <brad.king@kitware.com>2015-03-20 17:33:13 (GMT)
commited8e30b00d032594fbb67d62f8bd4319ae6e5907 (patch)
tree3723b51761e97bb679022ad8aeaebe25d5b7c003 /Source/cmGlobalNinjaGenerator.cxx
parentad094f435e005b484771acae36b79895c8e36e3f (diff)
downloadCMake-ed8e30b00d032594fbb67d62f8bd4319ae6e5907.zip
CMake-ed8e30b00d032594fbb67d62f8bd4319ae6e5907.tar.gz
CMake-ed8e30b00d032594fbb67d62f8bd4319ae6e5907.tar.bz2
cmGlobalNinjaGenerator: Optimize handling of known build outputs
Teach WriteUnknownExplicitDependencies to take ownership of the set of WriteBuild outputs immediately since no other methods need the data. This avoids re-inserting the whole set into another already populated set.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx17
1 files changed, 7 insertions, 10 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 1286793..6c612ab 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -955,6 +955,13 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
{
+ // We need to collect the set of known build outputs.
+ // Start with those generated by WriteBuild calls.
+ // No other method needs this so we can take ownership
+ // of the set locally and throw it out when we are done.
+ std::set<std::string> knownDependencies;
+ knownDependencies.swap(this->CombinedBuildOutputs);
+
//now write out the unknown explicit dependencies.
//union the configured files, evaluations files and the CombinedBuildOutputs,
@@ -971,7 +978,6 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
cmLocalNinjaGenerator *ng =
static_cast<cmLocalNinjaGenerator *>(this->LocalGenerators[0]);
- std::set<std::string> knownDependencies;
for (std::vector<cmLocalGenerator *>::const_iterator i =
this->LocalGenerators.begin(); i != this->LocalGenerators.end(); ++i)
{
@@ -1026,15 +1032,6 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
knownDependencies.insert( ng->ConvertToNinjaPath(i->first) );
}
- //insert outputs from all WirteBuild commands
- //these paths have already be encoded when added to CombinedBuildOutputs
- knownDependencies.insert(this->CombinedBuildOutputs.begin(),
- this->CombinedBuildOutputs.end());
-
- //after we have combined the data into knownDependencies we have no need
- //to keep this data around
- this->CombinedBuildOutputs.clear();
-
//now we difference with CombinedCustomCommandExplicitDependencies to find
//the list of items we know nothing about.
//We have encoded all the paths in CombinedCustomCommandExplicitDependencies