Commit d1a54ee2 authored by Sebastian Holtermann's avatar Sebastian Holtermann
Browse files

cmDepends: Reduce temporary object lifetime with local scopes

parent ae416a6b
...@@ -29,15 +29,15 @@ cmDepends::~cmDepends() ...@@ -29,15 +29,15 @@ cmDepends::~cmDepends()
bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends) bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends)
{ {
std::map<std::string, std::set<std::string>> dependencies;
{
// Lookup the set of sources to scan. // 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; std::vector<std::string> pairs;
cmSystemTools::ExpandListArgument(srcStr, pairs); {
std::string const srcLang = "CMAKE_DEPENDS_CHECK_" + this->Language;
std::map<std::string, std::set<std::string>> dependencies; cmMakefile* mf = this->LocalGenerator->GetMakefile();
cmSystemTools::ExpandListArgument(mf->GetSafeDefinition(srcLang), pairs);
}
for (std::vector<std::string>::iterator si = pairs.begin(); for (std::vector<std::string>::iterator si = pairs.begin();
si != pairs.end();) { si != pairs.end();) {
// Get the source and object file. // Get the source and object file.
...@@ -48,8 +48,8 @@ bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends) ...@@ -48,8 +48,8 @@ bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends)
std::string const& obj = *si++; std::string const& obj = *si++;
dependencies[obj].insert(src); dependencies[obj].insert(src);
} }
}
for (auto const& d : dependencies) { for (auto const& d : dependencies) {
// Write the dependencies for this pair. // Write the dependencies for this pair.
if (!this->WriteDependencies(d.second, d.first, makeDepends, if (!this->WriteDependencies(d.second, d.first, makeDepends,
internalDepends)) { internalDepends)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment