summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-02-17 21:55:18 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-02-17 21:55:18 +0000
commit57dddd4840bacb0c74be69c2fb34723d64af7c9a (patch)
tree934ef19bc660f735eff82ba6d4aa55ef3b4e3fca
parentd907016dd039d04ef26d12168b9a789a1e3fb591 (diff)
downloadbcm5719-llvm-57dddd4840bacb0c74be69c2fb34723d64af7c9a.tar.gz
bcm5719-llvm-57dddd4840bacb0c74be69c2fb34723d64af7c9a.zip
Sema: Replace some push_backs of expensive to move objects with emplace_back.
NFC. llvm-svn: 229557
-rw-r--r--clang/include/clang/Sema/TemplateDeduction.h10
-rw-r--r--clang/lib/Sema/Sema.cpp4
-rw-r--r--clang/lib/Sema/SemaExpr.cpp9
-rw-r--r--clang/lib/Sema/SemaOverload.cpp2
4 files changed, 8 insertions, 17 deletions
diff --git a/clang/include/clang/Sema/TemplateDeduction.h b/clang/include/clang/Sema/TemplateDeduction.h
index d1aa081eee6..229eb71cabc 100644
--- a/clang/include/clang/Sema/TemplateDeduction.h
+++ b/clang/include/clang/Sema/TemplateDeduction.h
@@ -91,9 +91,7 @@ public:
if (HasSFINAEDiagnostic)
return;
SuppressedDiagnostics.clear();
- SuppressedDiagnostics.push_back(
- std::make_pair(Loc, PartialDiagnostic::NullDiagnostic()));
- SuppressedDiagnostics.back().second.swap(PD);
+ SuppressedDiagnostics.emplace_back(Loc, std::move(PD));
HasSFINAEDiagnostic = true;
}
@@ -102,9 +100,7 @@ public:
PartialDiagnostic PD) {
if (HasSFINAEDiagnostic)
return;
- SuppressedDiagnostics.push_back(
- std::make_pair(Loc, PartialDiagnostic::NullDiagnostic()));
- SuppressedDiagnostics.back().second.swap(PD);
+ SuppressedDiagnostics.emplace_back(Loc, std::move(PD));
}
/// \brief Iterator over the set of suppressed diagnostics.
@@ -277,7 +273,7 @@ public:
/// \brief Add a new candidate with NumConversions conversion sequence slots
/// to the overload set.
TemplateSpecCandidate &addCandidate() {
- Candidates.push_back(TemplateSpecCandidate());
+ Candidates.emplace_back();
return Candidates.back();
}
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index f23d89e3b79..21e86a11f5d 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -122,9 +122,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
PP.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument,
&Context);
- ExprEvalContexts.push_back(
- ExpressionEvaluationContextRecord(PotentiallyEvaluated, 0,
- false, nullptr, false));
+ ExprEvalContexts.emplace_back(PotentiallyEvaluated, 0, false, nullptr, false);
FunctionScopes.push_back(new FunctionScopeInfo(Diags));
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index a9ea72577ab..4b807c10581 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -11606,12 +11606,9 @@ void
Sema::PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext,
Decl *LambdaContextDecl,
bool IsDecltype) {
- ExprEvalContexts.push_back(
- ExpressionEvaluationContextRecord(NewContext,
- ExprCleanupObjects.size(),
- ExprNeedsCleanups,
- LambdaContextDecl,
- IsDecltype));
+ ExprEvalContexts.emplace_back(NewContext, ExprCleanupObjects.size(),
+ ExprNeedsCleanups, LambdaContextDecl,
+ IsDecltype);
ExprNeedsCleanups = false;
if (!MaybeODRUseExprs.empty())
std::swap(MaybeODRUseExprs, ExprEvalContexts.back().SavedMaybeODRUseExprs);
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 134c88fd9de..53ebdd793b7 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -8118,7 +8118,7 @@ void Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
bool HasArithmeticOrEnumeralCandidateType = false;
SmallVector<BuiltinCandidateTypeSet, 2> CandidateTypes;
for (unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
- CandidateTypes.push_back(BuiltinCandidateTypeSet(*this));
+ CandidateTypes.emplace_back(*this);
CandidateTypes[ArgIdx].AddTypesConvertedFrom(Args[ArgIdx]->getType(),
OpLoc,
true,
OpenPOWER on IntegriCloud