Revert my last change and add a 'ForVirtualBase' parameter to EmitCXXConstructorCall instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102881 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp
index d4e26cf..5191f92 100644
--- a/lib/CodeGen/CGExprCXX.cpp
+++ b/lib/CodeGen/CGExprCXX.cpp
@@ -321,10 +321,17 @@
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 @@
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;