summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/MicrosoftCXXABI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/MicrosoftCXXABI.cpp')
-rw-r--r--clang/lib/CodeGen/MicrosoftCXXABI.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index 0e15f5054d8..2e41f934a2b 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -1467,16 +1467,18 @@ unsigned MicrosoftCXXABI::addImplicitConstructorArgs(
// Add the 'most_derived' argument second if we are variadic or last if not.
const FunctionProtoType *FPT = D->getType()->castAs<FunctionProtoType>();
- llvm::Value *MostDerivedArg =
- llvm::ConstantInt::get(CGM.Int32Ty, Type == Ctor_Complete);
- RValue RV = RValue::get(MostDerivedArg);
- if (MostDerivedArg) {
- if (FPT->isVariadic())
- Args.insert(Args.begin() + 1,
- CallArg(RV, getContext().IntTy, /*needscopy=*/false));
- else
- Args.add(RV, getContext().IntTy);
+ llvm::Value *MostDerivedArg;
+ if (Delegating) {
+ MostDerivedArg = getStructorImplicitParamValue(CGF);
+ } else {
+ MostDerivedArg = llvm::ConstantInt::get(CGM.Int32Ty, Type == Ctor_Complete);
}
+ RValue RV = RValue::get(MostDerivedArg);
+ if (FPT->isVariadic())
+ Args.insert(Args.begin() + 1,
+ CallArg(RV, getContext().IntTy, /*needscopy=*/false));
+ else
+ Args.add(RV, getContext().IntTy);
return 1; // Added one arg.
}
OpenPOWER on IntegriCloud