diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-02-08 05:30:18 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2014-05-02 17:22:19 (GMT) |
commit | 01b79c6385d32e635b5720d8075a60fd50577c66 (patch) | |
tree | 1d967b2f3f69321c23c19164a919677dca387f53 /Source/cmGlobalNinjaGenerator.cxx | |
parent | 3c640891177923e71a0a50d26988a3595a0f3c43 (diff) | |
download | CMake-01b79c6385d32e635b5720d8075a60fd50577c66.zip CMake-01b79c6385d32e635b5720d8075a60fd50577c66.tar.gz CMake-01b79c6385d32e635b5720d8075a60fd50577c66.tar.bz2 |
ninja: Don't use a stringstream to build an argument list
Streams are expensive to construct (looks like some locale-related
stuff), so use strings instead.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 88f1b08..a0caf0e 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -141,7 +141,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, cmGlobalNinjaGenerator::WriteComment(os, comment); - cmOStringStream arguments; + std::string arguments; // TODO: Better formatting for when there are multiple input/output files. @@ -150,7 +150,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, i != explicitDeps.end(); ++i) { - arguments << " " << EncodeIdent(EncodePath(*i), os); + arguments += " " + EncodeIdent(EncodePath(*i), os); //we need to track every dependency that comes in, since we are trying //to find dependencies that are side effects of build commands @@ -161,39 +161,39 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, // Write implicit dependencies. if(!implicitDeps.empty()) { - arguments << " |"; + arguments += " |"; for(cmNinjaDeps::const_iterator i = implicitDeps.begin(); i != implicitDeps.end(); ++i) - arguments << " " << EncodeIdent(EncodePath(*i), os); + arguments += " " + EncodeIdent(EncodePath(*i), os); } // Write order-only dependencies. if(!orderOnlyDeps.empty()) { - arguments << " ||"; + arguments += " ||"; for(cmNinjaDeps::const_iterator i = orderOnlyDeps.begin(); i != orderOnlyDeps.end(); ++i) - arguments << " " << EncodeIdent(EncodePath(*i), os); + arguments += " " + EncodeIdent(EncodePath(*i), os); } - arguments << "\n"; + arguments += "\n"; - cmOStringStream build; + std::string build; // Write outputs files. - build << "build"; + build += "build"; for(cmNinjaDeps::const_iterator i = outputs.begin(); i != outputs.end(); ++i) { - build << " " << EncodeIdent(EncodePath(*i), os); + build += " " + EncodeIdent(EncodePath(*i), os); this->CombinedBuildOutputs.insert( EncodePath(*i) ); } - build << ":"; + build += ":"; // Write the rule. - build << " " << rule; + build += " " + rule; // Write the variables bound to this build statement. cmOStringStream variable_assignments; @@ -203,9 +203,9 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, i->first, i->second, "", 1); // check if a response file rule should be used - std::string buildstr = build.str(); + std::string buildstr = build; std::string assignments = variable_assignments.str(); - const std::string args = arguments.str(); + const std::string& args = arguments; if (cmdLineLimit > 0 && args.size() + buildstr.size() + assignments.size() > (size_t) cmdLineLimit) { |