summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
authorPavel Solodovnikov <pa.solodovnikov@tensor.ru>2018-01-25 13:59:33 (GMT)
committerPavel Solodovnikov <pa.solodovnikov@tensor.ru>2018-01-26 10:24:45 (GMT)
commitc85bb007df37aad9f20355cdf4d7ca9af562cb20 (patch)
tree97027a278ef535cbb277ae91aa4c2eb620cb6978 /Source/cmCoreTryCompile.cxx
parentfa3ac83af0edf958d26b246109db6e3d6d128d70 (diff)
downloadCMake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.zip
CMake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.tar.gz
CMake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.tar.bz2
Reduce allocation of temporary values on heap.
- Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index fd258fe..7b28857 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -631,13 +631,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES)) {
vars.erase(kCMAKE_OSX_ARCHITECTURES);
std::string flag = "-DCMAKE_OSX_ARCHITECTURES=" + std::string(tcArchs);
- cmakeFlags.push_back(flag);
+ cmakeFlags.push_back(std::move(flag));
}
for (std::string const& var : vars) {
if (const char* val = this->Makefile->GetDefinition(var)) {
std::string flag = "-D" + var + "=" + val;
- cmakeFlags.push_back(flag);
+ cmakeFlags.push_back(std::move(flag));
}
}
}
@@ -938,7 +938,7 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
// a list of directories where to search for the compilation result
// at first directly in the binary dir
std::vector<std::string> searchDirs;
- searchDirs.push_back("");
+ searchDirs.emplace_back();
const char* config =
this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
@@ -946,12 +946,12 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
if (config && config[0]) {
std::string tmp = "/";
tmp += config;
- searchDirs.push_back(tmp);
+ searchDirs.push_back(std::move(tmp));
}
searchDirs.push_back("/Debug");
#if defined(__APPLE__)
std::string app = "/Debug/" + targetName + ".app";
- searchDirs.push_back(app);
+ searchDirs.push_back(std::move(app));
#endif
searchDirs.push_back("/Development");