Revert my last change and add a 'ForVirtualBase' parameter to EmitCXXConstructorCall instead.

llvm-svn: 102881
This commit is contained in:
Anders Carlsson 2010-05-02 23:20:53 +00:00
parent 4c638f1217
commit e11f9ce9dc
3 changed files with 15 additions and 12 deletions

View File

@ -1085,7 +1085,7 @@ CodeGenFunction::EmitCXXAggrConstructorCall(const CXXConstructorDecl *D,
{
CXXTemporariesCleanupScope Scope(*this);
EmitCXXConstructorCall(D, CXXConstructExpr::CK_Complete, Address,
EmitCXXConstructorCall(D, Ctor_Complete, /*ForVirtualBase=*/false, Address,
ArgBeg, ArgEnd);
}
@ -1223,13 +1223,10 @@ CodeGenFunction::GenerateCXXAggrDestructorHelper(const CXXDestructorDecl *D,
void
CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D,
CXXConstructExpr::ConstructionKind Kind,
CXXCtorType Type, bool ForVirtualBase,
llvm::Value *This,
CallExpr::const_arg_iterator ArgBeg,
CallExpr::const_arg_iterator ArgEnd) {
CXXCtorType Type =
(Kind == CXXConstructExpr::CK_Complete) ? Ctor_Complete : Ctor_Base;
if (D->isTrivial()) {
if (ArgBeg == ArgEnd) {
// Trivial default constructor, no codegen required.

View File

@ -321,10 +321,17 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest,
EmitCXXAggrConstructorCall(CD, Array, BaseAddrPtr,
E->arg_begin(), E->arg_end());
}
else
else {
CXXCtorType Type =
(E->getConstructionKind() == CXXConstructExpr::CK_Complete)
? Ctor_Complete : Ctor_Base;
bool ForVirtualBase =
E->getConstructionKind() == CXXConstructExpr::CK_VirtualBase;
// Call the constructor.
EmitCXXConstructorCall(CD, E->getConstructionKind(), Dest,
EmitCXXConstructorCall(CD, Type, ForVirtualBase, Dest,
E->arg_begin(), E->arg_end());
}
}
static CharUnits CalculateCookiePadding(ASTContext &Ctx, QualType ElementType) {
@ -468,8 +475,8 @@ static void EmitNewInitializer(CodeGenFunction &CGF, const CXXNewExpr *E,
QualType AllocType = E->getAllocatedType();
if (CXXConstructorDecl *Ctor = E->getConstructor()) {
CGF.EmitCXXConstructorCall(Ctor, CXXConstructExpr::CK_Complete, NewPtr,
E->constructor_arg_begin(),
CGF.EmitCXXConstructorCall(Ctor, Ctor_Complete, /*ForVirtualBase=*/false,
NewPtr, E->constructor_arg_begin(),
E->constructor_arg_end());
return;

View File

@ -815,9 +815,8 @@ public:
void EmitDelegateCXXConstructorCall(const CXXConstructorDecl *Ctor,
CXXCtorType CtorType,
const FunctionArgList &Args);
void EmitCXXConstructorCall(const CXXConstructorDecl *D,
CXXConstructExpr::ConstructionKind ConstructKind,
llvm::Value *This,
void EmitCXXConstructorCall(const CXXConstructorDecl *D, CXXCtorType Type,
bool ForVirtualBase, llvm::Value *This,
CallExpr::const_arg_iterator ArgBeg,
CallExpr::const_arg_iterator ArgEnd);