diff options
author | Pavel Solodovnikov <pa.solodovnikov@tensor.ru> | 2018-01-25 13:59:33 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <pa.solodovnikov@tensor.ru> | 2018-01-26 10:24:45 (GMT) |
commit | c85bb007df37aad9f20355cdf4d7ca9af562cb20 (patch) | |
tree | 97027a278ef535cbb277ae91aa4c2eb620cb6978 /Source/CTest/cmCTestBuildHandler.cxx | |
parent | fa3ac83af0edf958d26b246109db6e3d6d128d70 (diff) | |
download | CMake-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/CTest/cmCTestBuildHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index ef4d3c6..dbbe131 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -17,6 +17,7 @@ #include <set> #include <stdlib.h> #include <string.h> +#include <utility> static const char* cmCTestErrorMatches[] = { "^[Bb]us [Ee]rror", @@ -294,7 +295,7 @@ int cmCTestBuildHandler::ProcessHandler() cmCTestWarningErrorFileLine[entry].RegularExpressionString)) { r.FileIndex = cmCTestWarningErrorFileLine[entry].FileIndex; r.LineIndex = cmCTestWarningErrorFileLine[entry].LineIndex; - this->ErrorWarningFileLineRegex.push_back(r); + this->ErrorWarningFileLineRegex.push_back(std::move(r)); } else { cmCTestLog( this->CTest, ERROR_MESSAGE, "Problem Compiling regular expression: " @@ -894,7 +895,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, errorwarning.PreContext.clear(); errorwarning.PostContext.clear(); errorwarning.Error = false; - this->ErrorsAndWarnings.push_back(errorwarning); + this->ErrorsAndWarnings.push_back(std::move(errorwarning)); this->TotalWarnings++; } } @@ -917,7 +918,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, errorwarning.PreContext.clear(); errorwarning.PostContext.clear(); errorwarning.Error = true; - this->ErrorsAndWarnings.push_back(errorwarning); + this->ErrorsAndWarnings.push_back(std::move(errorwarning)); this->TotalErrors++; cmCTestLog(this->CTest, ERROR_MESSAGE, "There was an error: " << cmsysProcess_GetErrorString(cp) << std::endl); @@ -1009,7 +1010,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length, this->PreContext.clear(); // Store report - this->ErrorsAndWarnings.push_back(errorwarning); + this->ErrorsAndWarnings.push_back(std::move(errorwarning)); this->LastErrorOrWarning = this->ErrorsAndWarnings.end() - 1; this->PostContextCount = 0; } else { |