Convert a bunch of actions to smart pointers, and also bring PrintParserCallbacks a bit more in line with reality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67029 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 9372d33..9126d2a 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -847,16 +847,18 @@
if (Args.size() > 1)
CommaLoc
= SemaRef.PP.getLocForEndOfToken(Args[0]->getSourceRange().getEnd());
- Sema::ExprResult Result
- = SemaRef.ActOnCXXTypeConstructExpr(SourceRange(E->getTypeBeginLoc()
- /*, FIXME*/),
- T.getAsOpaquePtr(),
- /*FIXME*/E->getTypeBeginLoc(),
- (void**)&Args[0], Args.size(),
- /*HACK*/&CommaLoc,
- E->getSourceRange().getEnd());
- if (!Result.isInvalid())
- return SemaRef.Owned(Result);
+ Sema::OwningExprResult Result(
+ SemaRef.ActOnCXXTypeConstructExpr(SourceRange(E->getTypeBeginLoc()
+ /*, FIXME*/),
+ T.getAsOpaquePtr(),
+ /*FIXME*/E->getTypeBeginLoc(),
+ Sema::MultiExprArg(SemaRef,
+ (void**)&Args[0],
+ Args.size()),
+ /*HACK*/&CommaLoc,
+ E->getSourceRange().getEnd()));
+ // At this point, Args no longer owns the arguments, no matter what.
+ return move(Result);
}
// Clean up the instantiated arguments.