summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionLexer.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/cmGeneratorExpressionLexer.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/cmGeneratorExpressionLexer.cxx')
-rw-r--r--Source/cmGeneratorExpressionLexer.cxx16
1 files changed, 6 insertions, 10 deletions
diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx
index 931fd4d..95c79c1 100644
--- a/Source/cmGeneratorExpressionLexer.cxx
+++ b/Source/cmGeneratorExpressionLexer.cxx
@@ -12,8 +12,7 @@ static void InsertText(const char* upto, const char* c,
std::vector<cmGeneratorExpressionToken>& result)
{
if (upto != c) {
- result.push_back(cmGeneratorExpressionToken(
- cmGeneratorExpressionToken::Text, upto, c - upto));
+ result.emplace_back(cmGeneratorExpressionToken::Text, upto, c - upto);
}
}
@@ -30,8 +29,8 @@ std::vector<cmGeneratorExpressionToken> cmGeneratorExpressionLexer::Tokenize(
case '$':
if (c[1] == '<') {
InsertText(upto, c, result);
- result.push_back(cmGeneratorExpressionToken(
- cmGeneratorExpressionToken::BeginExpression, c, 2));
+ result.emplace_back(cmGeneratorExpressionToken::BeginExpression, c,
+ 2);
upto = c + 2;
++c;
SawBeginExpression = true;
@@ -39,21 +38,18 @@ std::vector<cmGeneratorExpressionToken> cmGeneratorExpressionLexer::Tokenize(
break;
case '>':
InsertText(upto, c, result);
- result.push_back(cmGeneratorExpressionToken(
- cmGeneratorExpressionToken::EndExpression, c, 1));
+ result.emplace_back(cmGeneratorExpressionToken::EndExpression, c, 1);
upto = c + 1;
SawGeneratorExpression = SawBeginExpression;
break;
case ':':
InsertText(upto, c, result);
- result.push_back(cmGeneratorExpressionToken(
- cmGeneratorExpressionToken::ColonSeparator, c, 1));
+ result.emplace_back(cmGeneratorExpressionToken::ColonSeparator, c, 1);
upto = c + 1;
break;
case ',':
InsertText(upto, c, result);
- result.push_back(cmGeneratorExpressionToken(
- cmGeneratorExpressionToken::CommaSeparator, c, 1));
+ result.emplace_back(cmGeneratorExpressionToken::CommaSeparator, c, 1);
upto = c + 1;
break;
default: