diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2010-01-31 20:58:15 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2010-01-31 20:58:15 +0000 |
commit | 6997aae42800d95a1189a6186af438feb19ecc54 (patch) | |
tree | fab0a7b21c1d2cde497901bc8ff29c361545ed5f /lib/Sema/SemaExprCXX.cpp | |
parent | 3bb9412788e04755cb509ec576f41afbed4efdd3 (diff) |
Switch expressions like T() and T(1,2) over to new-style initialization. I'm
not quite sure what we want to do about the AST representation; comments
welcome.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94967 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 847991d6f5..e944f328ed 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -263,29 +263,18 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, TypeTy *TypeRep, if (NumExprs > 1 || !Record->hasTrivialConstructor() || !Record->hasTrivialDestructor()) { - ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this); - - CXXConstructorDecl *Constructor - = PerformInitializationByConstructor(Ty, move(exprs), - TypeRange.getBegin(), - SourceRange(TypeRange.getBegin(), - RParenLoc), - DeclarationName(), - InitializationKind::CreateDirect(TypeRange.getBegin(), - LParenLoc, - RParenLoc), - ConstructorArgs); - - if (!Constructor) - return ExprError(); - - OwningExprResult Result = - BuildCXXTemporaryObjectExpr(Constructor, Ty, TyBeginLoc, - move_arg(ConstructorArgs), RParenLoc); - if (Result.isInvalid()) - return ExprError(); - - return MaybeBindToTemporary(Result.takeAs<Expr>()); + InitializedEntity Entity = InitializedEntity::InitializeTemporary(Ty); + InitializationKind Kind + = NumExprs ? InitializationKind::CreateDirect(TypeRange.getBegin(), + LParenLoc, RParenLoc) + : InitializationKind::CreateValue(TypeRange.getBegin(), + LParenLoc, RParenLoc); + InitializationSequence InitSeq(*this, Entity, Kind, Exprs, NumExprs); + OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, + move(exprs)); + + // FIXME: Improve AST representation? + return move(Result); } // Fall through to value-initialize an object of class type that |