diff options
author | Craig Scott <craig.scott@crascit.com> | 2017-08-21 13:13:53 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-08-21 13:13:59 (GMT) |
commit | 9a0a6f91ae5c8e25197d50e7045b6c4418f607b2 (patch) | |
tree | 277e4d2570cfe14b06de4c7a35748bef9f5faa1e /Source | |
parent | b14fdea3a63c7c8d91b0b02c57d1254a106376de (diff) | |
parent | 7bc65770171924e550d2937b07b54b83b9fb59ab (diff) | |
download | CMake-9a0a6f91ae5c8e25197d50e7045b6c4418f607b2.zip CMake-9a0a6f91ae5c8e25197d50e7045b6c4418f607b2.tar.gz CMake-9a0a6f91ae5c8e25197d50e7045b6c4418f607b2.tar.bz2 |
Merge topic 'perf-targetIter-missedGenerators'
7bc65770 Performance: Fix a few more unnecessary vector copies missed in af3fd6f
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1157
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmLocalGhsMultiGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio10Generator.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 17 | ||||
-rw-r--r-- | Source/cmLocalXCodeGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmServerProtocol.cxx | 2 |
10 files changed, 39 insertions, 34 deletions
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 42ab4d9..788a179 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -260,7 +260,7 @@ void cmGlobalGhsMultiGenerator::Generate() for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { cmLocalGhsMultiGenerator* lg = static_cast<cmLocalGhsMultiGenerator*>(this->LocalGenerators[i]); - std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets(); + const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets(); this->UpdateBuildFiles(tgts); } } @@ -436,9 +436,9 @@ std::string cmGlobalGhsMultiGenerator::GetFileNameFromPath( } void cmGlobalGhsMultiGenerator::UpdateBuildFiles( - std::vector<cmGeneratorTarget*> tgts) + const std::vector<cmGeneratorTarget*>& tgts) { - for (std::vector<cmGeneratorTarget*>::iterator tgtsI = tgts.begin(); + for (std::vector<cmGeneratorTarget*>::const_iterator tgtsI = tgts.begin(); tgtsI != tgts.end(); ++tgtsI) { const cmGeneratorTarget* tgt = *tgtsI; if (IsTgtForBuild(tgt)) { diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 7b3eebb..05a3a3c 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -116,7 +116,7 @@ private: std::vector<cmsys::String>::const_iterator end, GhsMultiGpj::Types projType); static std::string GetFileNameFromPath(std::string const& path); - void UpdateBuildFiles(std::vector<cmGeneratorTarget*> tgts); + void UpdateBuildFiles(const std::vector<cmGeneratorTarget*>& tgts); bool IsTgtForBuild(const cmGeneratorTarget* tgt); std::vector<cmGeneratedFileStream*> TargetSubProjects; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 7a42b72..ed1ef1b 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -320,10 +320,10 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets() cmGlobalVisualStudio7Generator::AddExtraIDETargets(); if (this->AddCheckTarget()) { for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - std::vector<cmGeneratorTarget*> tgts = + const std::vector<cmGeneratorTarget*>& tgts = this->LocalGenerators[i]->GetGeneratorTargets(); // All targets depend on the build-system check target. - for (std::vector<cmGeneratorTarget*>::iterator ti = tgts.begin(); + for (std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin(); ti != tgts.end(); ++ti) { if ((*ti)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { (*ti)->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 87a22d1..f85e409 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -82,8 +82,10 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() // Now make all targets depend on the ALL_BUILD target for (std::vector<cmLocalGenerator*>::iterator i = gen.begin(); i != gen.end(); ++i) { - std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = + (*i)->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator t = + targets.begin(); t != targets.end(); ++t) { cmGeneratorTarget* tgt = *t; if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET || @@ -298,8 +300,10 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() std::vector<cmLocalGenerator*>& gen = it->second; for (std::vector<cmLocalGenerator*>::iterator i = gen.begin(); i != gen.end(); ++i) { - std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = + (*i)->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator ti = + targets.begin(); ti != targets.end(); ++ti) { this->ComputeVSTargetDepends(*ti); } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 071d49c..8f260ec 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -440,8 +440,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets( continue; } - std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); l++) { cmGeneratorTarget* target = *l; @@ -925,12 +925,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets) { this->SetCurrentLocalGenerator(gen); - std::vector<cmGeneratorTarget*> tgts = + const std::vector<cmGeneratorTarget*>& tgts = this->CurrentLocalGenerator->GetGeneratorTargets(); typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets> cmSortedTargets; cmSortedTargets sortedTargets; - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); l++) { sortedTargets[(*l)->GetName()] = *l; } @@ -1210,7 +1210,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( void cmGlobalXCodeGenerator::ForceLinkerLanguages() { for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - std::vector<cmGeneratorTarget*> tgts = + const std::vector<cmGeneratorTarget*>& tgts = this->LocalGenerators[i]->GetGeneratorTargets(); // All targets depend on the build-system check target. for (std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin(); @@ -2706,8 +2706,8 @@ bool cmGlobalXCodeGenerator::CreateGroups( i != generators.end(); ++i) { cmMakefile* mf = (*i)->GetMakefile(); std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups(); - std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + const std::vector<cmGeneratorTarget*>& tgts = (*i)->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); l++) { cmGeneratorTarget* gtgt = *l; diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index 5f37af5..ab6774e 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -20,9 +20,9 @@ cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() void cmLocalGhsMultiGenerator::Generate() { - std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); + const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 85d4a73..db1776a 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -60,8 +60,8 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator() void cmLocalVisualStudio10Generator::Generate() { - std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index dd08e5b..857ce46 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -62,8 +62,8 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator() void cmLocalVisualStudio7Generator::AddHelperCommands() { // Now create GUIDs for targets - std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; @@ -91,8 +91,9 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules() // specification source changes. if (cmSourceFile* sf = this->CreateVCProjBuildRule()) { // Add the rule to targets that need it. - std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + const std::vector<cmGeneratorTarget*>& tgts = + this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { if ((*l)->GetType() == cmStateEnums::GLOBAL_TARGET) { continue; @@ -110,8 +111,8 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() // Visual Studio .NET 2003 Service Pack 1 will not run post-build // commands for targets in which no sources are built. Add dummy // rules to force these targets to build. - std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); l++) { if ((*l)->GetType() == cmStateEnums::GLOBAL_TARGET) { std::vector<std::string> no_depends; @@ -150,10 +151,10 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles() } // Get the set of targets in this directory. - std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); + const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); // Create the project file for each target. - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); l++) { if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 739ef43..355c394 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -42,8 +42,8 @@ void cmLocalXCodeGenerator::Generate() { cmLocalGenerator::Generate(); - std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator iter = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) { (*iter)->HasMacOSXRpathInstallNameDir(""); } @@ -53,8 +53,8 @@ void cmLocalXCodeGenerator::GenerateInstallRules() { cmLocalGenerator::GenerateInstallRules(); - std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator iter = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) { (*iter)->HasMacOSXRpathInstallNameDir(""); } diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index baaf11a..2063c82 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -903,7 +903,7 @@ static Json::Value DumpTargetsList( std::vector<cmGeneratorTarget*> targetList; for (const auto& lgIt : generators) { - auto list = lgIt->GetGeneratorTargets(); + const auto& list = lgIt->GetGeneratorTargets(); targetList.insert(targetList.end(), list.begin(), list.end()); } std::sort(targetList.begin(), targetList.end()); |