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 /lib/ARCMigrate | |
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 'lib/ARCMigrate')
-rw-r--r-- | lib/ARCMigrate/ObjCMT.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp index a43879c236..8c2e0f4de8 100644 --- a/lib/ARCMigrate/ObjCMT.cpp +++ b/lib/ARCMigrate/ObjCMT.cpp @@ -2283,7 +2283,7 @@ bool arcmt::getFileRemappingsFromFileList( continue; } - remap.push_back(std::make_pair(I->first->getName(), TempFile)); + remap.emplace_back(I->first->getName(), TempFile); } return hasErrorOccurred; |