[cfe-commits] r81160 - in /cfe/trunk/lib/Sema: Sema.h SemaDecl.cpp SemaDeclCXX.cpp SemaExprCXX.cpp SemaInit.cpp TreeTransform.h
Anders Carlsson
andersca at mac.com
Mon Sep 7 15:23:31 PDT 2009
Author: andersca
Date: Mon Sep 7 17:23:31 2009
New Revision: 81160
URL: http://llvm.org/viewvc/llvm-project?rev=81160&view=rev
Log:
BuildCXXConstructExpr now takes a MultiExprArg.
Modified:
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=81160&r1=81159&r2=81160&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Mon Sep 7 17:23:31 2009
@@ -1810,14 +1810,14 @@
bool InitializeVarWithConstructor(VarDecl *VD,
CXXConstructorDecl *Constructor,
QualType DeclInitType,
- Expr **Exprs, unsigned NumExprs);
+ MultiExprArg Exprs);
/// BuildCXXConstructExpr - Creates a complete call to a constructor,
/// including handling of its default argument expressions.
OwningExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc,
QualType DeclInitType,
CXXConstructorDecl *Constructor,
- Expr **Exprs, unsigned NumExprs);
+ MultiExprArg Exprs);
// FIXME: Can re remove this and have the above BuildCXXConstructExpr check if
// the constructor can be elidable?
@@ -1825,7 +1825,7 @@
QualType DeclInitType,
CXXConstructorDecl *Constructor,
bool Elidable,
- Expr **Exprs, unsigned NumExprs);
+ MultiExprArg Exprs);
OwningExprResult BuildCXXTemporaryObjectExpr(CXXConstructorDecl *Cons,
QualType writtenTy,
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=81160&r1=81159&r2=81160&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Sep 7 17:23:31 2009
@@ -3284,7 +3284,8 @@
Var->setInvalidDecl();
else {
if (!RD->hasTrivialConstructor() || !RD->hasTrivialDestructor()) {
- if (InitializeVarWithConstructor(Var, Constructor, InitType, 0, 0))
+ if (InitializeVarWithConstructor(Var, Constructor, InitType,
+ MultiExprArg(*this)))
Var->setInvalidDecl();
}
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=81160&r1=81159&r2=81160&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Sep 7 17:23:31 2009
@@ -2809,8 +2809,8 @@
Sema::OwningExprResult
Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
- CXXConstructorDecl *Constructor,
- Expr **Exprs, unsigned NumExprs) {
+ CXXConstructorDecl *Constructor,
+ MultiExprArg ExprArgs) {
bool Elidable = false;
// [class.copy]p15:
@@ -2821,8 +2821,8 @@
//all, even if the class copy constructor or destructor have side effects.
// FIXME: Is this enough?
- if (Constructor->isCopyConstructor(Context) && NumExprs == 1) {
- Expr *E = Exprs[0];
+ if (Constructor->isCopyConstructor(Context) && ExprArgs.size() == 1) {
+ Expr *E = ((Expr **)ExprArgs.get())[0];
while (CXXBindTemporaryExpr *BE = dyn_cast<CXXBindTemporaryExpr>(E))
E = BE->getSubExpr();
@@ -2831,7 +2831,7 @@
}
return BuildCXXConstructExpr(ConstructLoc, DeclInitType, Constructor,
- Elidable, Exprs, NumExprs);
+ Elidable, move(ExprArgs));
}
/// BuildCXXConstructExpr - Creates a complete call to a constructor,
@@ -2839,7 +2839,10 @@
Sema::OwningExprResult
Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
CXXConstructorDecl *Constructor, bool Elidable,
- Expr **Exprs, unsigned NumExprs) {
+ MultiExprArg ExprArgs) {
+ unsigned NumExprs = ExprArgs.size();
+ Expr **Exprs = (Expr **)ExprArgs.release();
+
ExprOwningPtr<CXXConstructExpr> Temp(this,
CXXConstructExpr::Create(Context,
DeclInitType,
@@ -2897,10 +2900,10 @@
bool Sema::InitializeVarWithConstructor(VarDecl *VD,
CXXConstructorDecl *Constructor,
QualType DeclInitType,
- Expr **Exprs, unsigned NumExprs) {
+ MultiExprArg Exprs) {
OwningExprResult TempResult =
BuildCXXConstructExpr(VD->getLocation(), DeclInitType, Constructor,
- Exprs, NumExprs);
+ move(Exprs));
if (TempResult.isInvalid())
return true;
@@ -3003,7 +3006,7 @@
else {
VDecl->setCXXDirectInitializer(true);
if (InitializeVarWithConstructor(VDecl, Constructor, DeclInitType,
- (Expr**)Exprs.release(), NumExprs))
+ move(Exprs)))
RealDecl->setInvalidDecl();
FinalizeVarWithDestructor(VDecl, DeclInitType);
}
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=81160&r1=81159&r2=81160&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Mon Sep 7 17:23:31 2009
@@ -942,8 +942,8 @@
DefaultFunctionArrayConversion(From);
OwningExprResult InitResult =
BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
- ToType.getNonReferenceType(),
- CD, &From, 1);
+ ToType.getNonReferenceType(), CD,
+ MultiExprArg(*this, (void**)&From, 1));
// Take ownership of this expression.
From = InitResult.takeAs<Expr>();
CastKind = CastExpr::CK_ConstructorConversion ;
@@ -988,7 +988,8 @@
OwningExprResult FromResult =
BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
- ToType, SCS.CopyConstructor, &From, 1);
+ ToType, SCS.CopyConstructor,
+ MultiExprArg(*this, (void**)&From, 1));
if (FromResult.isInvalid())
return true;
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=81160&r1=81159&r2=81160&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Mon Sep 7 17:23:31 2009
@@ -182,7 +182,8 @@
OwningExprResult InitResult =
BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
- DeclType, Constructor, &Init, 1);
+ DeclType, Constructor,
+ MultiExprArg(*this, (void**)&Init, 1));
if (InitResult.isInvalid())
return true;
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=81160&r1=81159&r2=81160&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Mon Sep 7 17:23:31 2009
@@ -1448,12 +1448,10 @@
CXXConstructorDecl *Constructor,
bool IsElidable,
MultiExprArg Args) {
- unsigned NumArgs = Args.size();
- Expr **ArgsExprs = (Expr **)Args.release();
return getSema().BuildCXXConstructExpr(/*FIXME:ConstructLoc*/
SourceLocation(),
T, Constructor, IsElidable,
- ArgsExprs, NumArgs);
+ move(Args));
}
/// \brief Build a new object-construction expression.
More information about the cfe-commits
mailing list