diff options
author | Brad King <brad.king@kitware.com> | 2019-05-02 13:41:59 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-05-02 13:42:08 (GMT) |
commit | 3b4315dc23bdedb3163a0c84b9fdbae2324470c6 (patch) | |
tree | 31ee970a0828a53f3cb6a17a8a159cb677f897b9 /Source | |
parent | 1ee21c6ec5ef783d2b960fc3e13161582cf22e10 (diff) | |
parent | 75643755a1492f3d07e811541207769341eb2b9e (diff) | |
download | CMake-3b4315dc23bdedb3163a0c84b9fdbae2324470c6.zip CMake-3b4315dc23bdedb3163a0c84b9fdbae2324470c6.tar.gz CMake-3b4315dc23bdedb3163a0c84b9fdbae2324470c6.tar.bz2 |
Merge topic 'code-cleanup-3'
75643755a1 cmGlobalVisualStudioGenerator: remove redundant variables
615fb2633c cmGlobalVisualStudioGenerator: use cmJoin to join the filenames
30c98db61b cmGlobalVisualStudioGenerator: use auto instead of iterator types
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3257
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 39c325c..cd0355f 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -203,9 +203,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() // Now make all targets depend on the ALL_BUILD target for (cmLocalGenerator const* i : gen) { - std::vector<cmGeneratorTarget*> const& targets = - i->GetGeneratorTargets(); - for (cmGeneratorTarget* tgt : targets) { + for (cmGeneratorTarget* tgt : i->GetGeneratorTargets()) { if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET || tgt->IsImported()) { continue; @@ -318,17 +316,7 @@ void cmGlobalVisualStudioGenerator::CallVisualStudioMacro( std::vector<std::string> filenames; this->GetFilesReplacedDuringGenerate(filenames); if (!filenames.empty()) { - // Convert vector to semi-colon delimited string of filenames: - std::string projects; - std::vector<std::string>::iterator it = filenames.begin(); - if (it != filenames.end()) { - projects = *it; - ++it; - } - for (; it != filenames.end(); ++it) { - projects += ";"; - projects += *it; - } + std::string projects = cmJoin(filenames, ";"); cmCallVisualStudioMacro::CallMacro( topLevelSlnName, CMAKE_VSMACROS_RELOAD_MACRONAME, projects, this->GetCMakeInstance()->GetDebugOutput()); @@ -368,7 +356,7 @@ void cmGlobalVisualStudioGenerator::FillLinkClosure( cmGlobalVisualStudioGenerator::TargetSet const& cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* target) { - TargetSetMap::iterator i = this->TargetLinkClosure.find(target); + auto i = this->TargetLinkClosure.find(target); if (i == this->TargetLinkClosure.end()) { TargetSetMap::value_type entry(target, TargetSet()); i = this->TargetLinkClosure.insert(entry).first; @@ -402,11 +390,8 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() return false; } for (auto const& it : this->ProjectMap) { - std::vector<cmLocalGenerator*> const& gen = it.second; - for (const cmLocalGenerator* i : gen) { - std::vector<cmGeneratorTarget*> const& targets = - i->GetGeneratorTargets(); - for (cmGeneratorTarget* ti : targets) { + for (const cmLocalGenerator* i : it.second) { + for (cmGeneratorTarget* ti : i->GetGeneratorTargets()) { this->ComputeVSTargetDepends(ti); } } @@ -458,8 +443,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( std::set<cmGeneratorTarget const*> linkDepends; if (target->GetType() != cmStateEnums::STATIC_LIBRARY) { for (cmTargetDepend const& di : depends) { - cmTargetDepend dep = di; - if (dep.IsLink()) { + if (di.IsLink()) { this->FollowLinkDepends(di, linkDepends); } } @@ -468,8 +452,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( // Collect explicit util dependencies (add_dependencies). std::set<cmGeneratorTarget const*> utilDepends; for (cmTargetDepend const& di : depends) { - cmTargetDepend dep = di; - if (dep.IsUtil()) { + if (di.IsUtil()) { this->FollowLinkDepends(di, utilDepends); } } @@ -513,7 +496,7 @@ bool cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf) std::string cmGlobalVisualStudioGenerator::GetUtilityDepend( cmGeneratorTarget const* target) { - UtilityDependsMap::iterator i = this->UtilityDepends.find(target); + auto i = this->UtilityDepends.find(target); if (i == this->UtilityDepends.end()) { std::string name = this->WriteUtilityDepend(target); UtilityDependsMap::value_type entry(target, name); @@ -939,11 +922,10 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( std::vector<std::string> objs; for (cmSourceFile const* it : objectSources) { // Find the object file name corresponding to this source file. - std::map<cmSourceFile const*, std::string>::const_iterator map_it = - mapping.find(it); // It must exist because we populated the mapping just above. - assert(!map_it->second.empty()); - std::string objFile = obj_dir + map_it->second; + const auto& v = mapping[it]; + assert(!v.empty()); + std::string objFile = obj_dir + v; objs.push_back(objFile); } std::vector<cmSourceFile const*> externalObjectSources; |