forked from OSchip/llvm-project
[Windows] Abstract pure virtual method calls in the ABI. Fix the Windows ABI to forward to the correct function.
llvm-svn: 160373
This commit is contained in:
parent
7c1598caaa
commit
2ce88ef9a7
|
@ -193,6 +193,9 @@ public:
|
|||
virtual void EmitReturnFromThunk(CodeGenFunction &CGF,
|
||||
RValue RV, QualType ResultType);
|
||||
|
||||
/// Gets the pure virtual member call function.
|
||||
virtual StringRef GetPureVirtualCallName() = 0;
|
||||
|
||||
/**************************** Array cookies ******************************/
|
||||
|
||||
/// Returns the extra size required in order to store the array
|
||||
|
|
|
@ -569,15 +569,15 @@ CodeGenVTables::CreateVTableInitializer(const CXXRecordDecl *RD,
|
|||
|
||||
if (cast<CXXMethodDecl>(GD.getDecl())->isPure()) {
|
||||
// We have a pure virtual member function.
|
||||
if (!PureVirtualFn) {
|
||||
llvm::FunctionType *Ty =
|
||||
llvm::FunctionType::get(CGM.VoidTy, /*isVarArg=*/false);
|
||||
PureVirtualFn =
|
||||
CGM.CreateRuntimeFunction(Ty, "__cxa_pure_virtual");
|
||||
PureVirtualFn = llvm::ConstantExpr::getBitCast(PureVirtualFn,
|
||||
Int8PtrTy);
|
||||
if (!PureVirtualFn ) {
|
||||
llvm::FunctionType *Ty =
|
||||
llvm::FunctionType::get(CGM.VoidTy, /*isVarArg=*/false);
|
||||
StringRef PureCallName = CGM.getCXXABI().GetPureVirtualCallName();
|
||||
PureVirtualFn = CGM.CreateRuntimeFunction(Ty, PureCallName);
|
||||
PureVirtualFn = llvm::ConstantExpr::getBitCast(PureVirtualFn,
|
||||
CGM.Int8PtrTy);
|
||||
}
|
||||
|
||||
|
||||
Init = PureVirtualFn;
|
||||
} else {
|
||||
// Check if we should use a thunk.
|
||||
|
|
|
@ -108,6 +108,8 @@ public:
|
|||
|
||||
void EmitInstanceFunctionProlog(CodeGenFunction &CGF);
|
||||
|
||||
StringRef GetPureVirtualCallName() { return "__cxa_pure_virtual"; }
|
||||
|
||||
CharUnits getArrayCookieSizeImpl(QualType elementType);
|
||||
llvm::Value *InitializeArrayCookie(CodeGenFunction &CGF,
|
||||
llvm::Value *NewPtr,
|
||||
|
|
|
@ -28,6 +28,8 @@ class MicrosoftCXXABI : public CGCXXABI {
|
|||
public:
|
||||
MicrosoftCXXABI(CodeGenModule &CGM) : CGCXXABI(CGM) {}
|
||||
|
||||
StringRef GetPureVirtualCallName() { return "_purecall"; }
|
||||
|
||||
void BuildConstructorSignature(const CXXConstructorDecl *Ctor,
|
||||
CXXCtorType Type,
|
||||
CanQualType &ResTy,
|
||||
|
|
Loading…
Reference in New Issue