summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionParser.cxx
diff options
context:
space:
mode:
authorFrank Winklmeier <frank.winklmeier@cern.ch>2018-02-20 14:38:08 (GMT)
committerBrad King <brad.king@kitware.com>2018-02-21 16:11:50 (GMT)
commit46436581c668365ff8df25dcfca5b13a0fd50200 (patch)
tree119631a15575990882ce566f24c0522ef263d06b /Source/cmGeneratorExpressionParser.cxx
parent31419815aa8cd376b1cdfd1d77c0d5c4802f4ecc (diff)
downloadCMake-46436581c668365ff8df25dcfca5b13a0fd50200.zip
CMake-46436581c668365ff8df25dcfca5b13a0fd50200.tar.gz
CMake-46436581c668365ff8df25dcfca5b13a0fd50200.tar.bz2
cmGeneratorExpression: Use std::move to avoid vector copies
Use move semantics in GeneratorExpressionContent::SetIdentifier and ::SetParameters to avoid vector copies.
Diffstat (limited to 'Source/cmGeneratorExpressionParser.cxx')
-rw-r--r--Source/cmGeneratorExpressionParser.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index 278de04..7b4dc7b 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -6,6 +6,7 @@
#include <assert.h>
#include <stddef.h>
+#include <utility>
cmGeneratorExpressionParser::cmGeneratorExpressionParser(
const std::vector<cmGeneratorExpressionToken>& tokens)
@@ -92,7 +93,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
assert(this->it != this->Tokens.end());
++this->it;
--this->NestingLevel;
- content->SetIdentifier(identifier);
+ content->SetIdentifier(std::move(identifier));
result.push_back(content);
return;
}
@@ -198,8 +199,8 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
((this->it - 1)->Content - startToken->Content) + (this->it - 1)->Length;
GeneratorExpressionContent* content =
new GeneratorExpressionContent(startToken->Content, contentLength);
- content->SetIdentifier(identifier);
- content->SetParameters(parameters);
+ content->SetIdentifier(std::move(identifier));
+ content->SetParameters(std::move(parameters));
result.push_back(content);
}