aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
index 9e490c6d..d30c975 100644
--- a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
@@ -95,7 +95,10 @@ public:
clang::GlobalDecl gd, Address thisAddr,
mlir::Type ty,
SourceLocation loc) override;
-
+ mlir::Value emitVirtualDestructorCall(CIRGenFunction &cgf,
+ const CXXDestructorDecl *dtor,
+ CXXDtorType dtorType, Address thisAddr,
+ DeleteOrMemberCallExpr e) override;
mlir::Value getVTableAddressPoint(BaseSubobject base,
const CXXRecordDecl *vtableClass) override;
mlir::Value getVTableAddressPointInStructorWithVTT(
@@ -465,6 +468,29 @@ void CIRGenItaniumCXXABI::emitVTableDefinitions(CIRGenVTables &cgvt,
}
}
+mlir::Value CIRGenItaniumCXXABI::emitVirtualDestructorCall(
+ CIRGenFunction &cgf, const CXXDestructorDecl *dtor, CXXDtorType dtorType,
+ Address thisAddr, DeleteOrMemberCallExpr expr) {
+ auto *callExpr = dyn_cast<const CXXMemberCallExpr *>(expr);
+ auto *delExpr = dyn_cast<const CXXDeleteExpr *>(expr);
+ assert((callExpr != nullptr) ^ (delExpr != nullptr));
+ assert(callExpr == nullptr || callExpr->arg_begin() == callExpr->arg_end());
+ assert(dtorType == Dtor_Deleting || dtorType == Dtor_Complete);
+
+ GlobalDecl globalDecl(dtor, dtorType);
+ const CIRGenFunctionInfo *fnInfo =
+ &cgm.getTypes().arrangeCXXStructorDeclaration(globalDecl);
+ const cir::FuncType &fnTy = cgm.getTypes().getFunctionType(*fnInfo);
+ auto callee = CIRGenCallee::forVirtual(callExpr, globalDecl, thisAddr, fnTy);
+
+ QualType thisTy =
+ callExpr ? callExpr->getObjectType() : delExpr->getDestroyedType();
+
+ cgf.emitCXXDestructorCall(globalDecl, callee, thisAddr.emitRawPointer(),
+ thisTy, nullptr, QualType(), nullptr);
+ return nullptr;
+}
+
void CIRGenItaniumCXXABI::emitVirtualInheritanceTables(
const CXXRecordDecl *rd) {
CIRGenVTables &vtables = cgm.getVTables();