diff options
author | Pavel Solodovnikov <pa.solodovnikov@tensor.ru> | 2018-01-25 16:59:33 +0300 |
---|---|---|
committer | Pavel Solodovnikov <pa.solodovnikov@tensor.ru> | 2018-01-26 13:24:45 +0300 |
commit | c85bb007df37aad9f20355cdf4d7ca9af562cb20 (patch) | |
tree | 97027a278ef535cbb277ae91aa4c2eb620cb6978 /Source/cmMakefileLibraryTargetGenerator.cxx | |
parent | fa3ac83af0edf958d26b246109db6e3d6d128d70 (diff) | |
download | cmake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.tar.gz |
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/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index ab15daf073..cb99b3eafe 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -897,7 +897,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string cmd = launcher + acc; rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, cmd, vars); - real_link_commands.push_back(cmd); + real_link_commands.push_back(std::move(cmd)); } } // Append to the archive with the other object sets. @@ -907,7 +907,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string cmd = launcher + aac; rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, cmd, vars); - real_link_commands.push_back(cmd); + real_link_commands.push_back(std::move(cmd)); } } // Finish the archive. @@ -918,7 +918,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( vars); // If there is no ranlib the command will be ":". Skip it. if (!cmd.empty() && cmd[0] != ':') { - real_link_commands.push_back(cmd); + real_link_commands.push_back(std::move(cmd)); } } } else { @@ -931,7 +931,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); cmakeCommand += " -E __run_co_compile --lwyu="; cmakeCommand += targetOutPathReal; - real_link_commands.push_back(cmakeCommand); + real_link_commands.push_back(std::move(cmakeCommand)); } // Expand placeholders. @@ -972,7 +972,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( symlink += targetOutPathSO; symlink += " "; symlink += targetOutPath; - commands1.push_back(symlink); + commands1.push_back(std::move(symlink)); this->LocalGenerator->CreateCDCommand( commands1, this->Makefile->GetCurrentBinaryDirectory(), this->LocalGenerator->GetBinaryDirectory()); |