diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-03-12 10:29:27 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-03-12 10:29:27 (GMT) |
commit | d1a54ee26a5a9637b60d094c2b4a7b3251c78b1c (patch) | |
tree | 1154f0366b31e694b8a4c15da29768052cb1a71c /Source | |
parent | ae416a6b5c58f1e897692fcddf3154483782e0bd (diff) | |
download | CMake-d1a54ee26a5a9637b60d094c2b4a7b3251c78b1c.zip CMake-d1a54ee26a5a9637b60d094c2b4a7b3251c78b1c.tar.gz CMake-d1a54ee26a5a9637b60d094c2b4a7b3251c78b1c.tar.bz2 |
cmDepends: Reduce temporary object lifetime with local scopes
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmDepends.cxx | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 7d1d316..c128b02 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -29,27 +29,27 @@ cmDepends::~cmDepends() bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends) { - // Lookup the set of sources to scan. - std::string srcLang = "CMAKE_DEPENDS_CHECK_"; - srcLang += this->Language; - cmMakefile* mf = this->LocalGenerator->GetMakefile(); - std::string const& srcStr = mf->GetSafeDefinition(srcLang); - std::vector<std::string> pairs; - cmSystemTools::ExpandListArgument(srcStr, pairs); - std::map<std::string, std::set<std::string>> dependencies; - for (std::vector<std::string>::iterator si = pairs.begin(); - si != pairs.end();) { - // Get the source and object file. - std::string const& src = *si++; - if (si == pairs.end()) { - break; + { + // Lookup the set of sources to scan. + std::vector<std::string> pairs; + { + std::string const srcLang = "CMAKE_DEPENDS_CHECK_" + this->Language; + cmMakefile* mf = this->LocalGenerator->GetMakefile(); + cmSystemTools::ExpandListArgument(mf->GetSafeDefinition(srcLang), pairs); + } + for (std::vector<std::string>::iterator si = pairs.begin(); + si != pairs.end();) { + // Get the source and object file. + std::string const& src = *si++; + if (si == pairs.end()) { + break; + } + std::string const& obj = *si++; + dependencies[obj].insert(src); } - std::string const& obj = *si++; - dependencies[obj].insert(src); } for (auto const& d : dependencies) { - // Write the dependencies for this pair. if (!this->WriteDependencies(d.second, d.first, makeDepends, internalDepends)) { |