summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.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/cmTarget.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/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 663a4c9..33437a1 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -500,7 +500,7 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
}
if (!srcFiles.empty()) {
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->SourceEntries.push_back(srcFiles);
+ this->Internal->SourceEntries.push_back(std::move(srcFiles));
this->Internal->SourceBacktraces.push_back(lfbt);
}
}
@@ -747,10 +747,12 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib,
return;
}
- cmTarget::LibraryID tmp;
- tmp.first = lib;
- tmp.second = llt;
- this->OriginalLinkLibraries.push_back(tmp);
+ {
+ cmTarget::LibraryID tmp;
+ tmp.first = lib;
+ tmp.second = llt;
+ this->OriginalLinkLibraries.emplace_back(lib, llt);
+ }
// Add the explicit dependency information for this target. This is
// simply a set of libraries separated by ";". There should always