summaryrefslogtreecommitdiffstats
path: root/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-05-29 19:42:19 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-05-29 19:42:19 +0000
commitb7b56528f9b78d5ae89e023a0dd5c1fcc7215875 (patch)
treebcf68eeff81cd0c634e215f6261b53b8520930e2 /lib/StaticAnalyzer/Frontend/ModelInjector.cpp
parente8bd67912a47e36f28144fced9aaa5f003d318a8 (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/StaticAnalyzer/Frontend/ModelInjector.cpp')
-rw-r--r--lib/StaticAnalyzer/Frontend/ModelInjector.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Frontend/ModelInjector.cpp b/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
index 63bb1e2458..699549f817 100644
--- a/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
+++ b/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
@@ -69,7 +69,7 @@ void ModelInjector::onBodySynthesis(const NamedDecl *D) {
FrontendOptions &FrontendOpts = Invocation->getFrontendOpts();
InputKind IK = IK_CXX; // FIXME
FrontendOpts.Inputs.clear();
- FrontendOpts.Inputs.push_back(FrontendInputFile(fileName, IK));
+ FrontendOpts.Inputs.emplace_back(fileName, IK);
FrontendOpts.DisableFree = true;
Invocation->getDiagnosticOpts().VerifyDiagnostics = 0;