diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-05-29 19:42:19 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-05-29 19:42:19 +0000 |
commit | b7b56528f9b78d5ae89e023a0dd5c1fcc7215875 (patch) | |
tree | bcf68eeff81cd0c634e215f6261b53b8520930e2 /include/clang/Lex/Preprocessor.h | |
parent | e8bd67912a47e36f28144fced9aaa5f003d318a8 (diff) |
Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.
Call sites were found with the ASTMatcher + some semi-automated cleanup.
memberCallExpr(
argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
hasArgument(0, bindTemporaryExpr(
hasType(recordDecl(hasNonTrivialDestructor())),
has(constructExpr()))),
unless(isInTemplateInstantiation()))
No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238601 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/Preprocessor.h')
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index ea15dbdf21..e0e0919912 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -1617,9 +1617,9 @@ private: void PushIncludeMacroStack() { assert(CurLexerKind != CLK_CachingLexer && "cannot push a caching lexer"); - IncludeMacroStack.push_back(IncludeStackInfo( + IncludeMacroStack.emplace_back( CurLexerKind, CurSubmodule, std::move(CurLexer), std::move(CurPTHLexer), - CurPPLexer, std::move(CurTokenLexer), CurDirLookup)); + CurPPLexer, std::move(CurTokenLexer), CurDirLookup); CurPPLexer = nullptr; } |