================
@@ -1587,28 +1587,82 @@ namespace {
}
};
+ // This function implements generation of scalar deleting destructor body for
+ // the case when the destructor also accepts an implicit flag. Right now only
+ // Microsoft ABI requires deleting destructors to accept implicit flags.
+ // The flag indicates whether an operator delete should be called and whether
+ // it should be a class-specific operator delete or a global one.
void EmitConditionalDtorDeleteCall(CodeGenFunction &CGF,
llvm::Value *ShouldDeleteCondition,
bool ReturnAfterDelete) {
+ const CXXDestructorDecl *Dtor = cast<CXXDestructorDecl>(CGF.CurCodeDecl);
+ const CXXRecordDecl *ClassDecl = Dtor->getParent();
+ const FunctionDecl *OD = Dtor->getOperatorDelete();
+ assert(OD->isDestroyingOperatorDelete() == ReturnAfterDelete &&
+ "unexpected value for ReturnAfterDelete");
+ auto *CondTy = cast<llvm::IntegerType>(ShouldDeleteCondition->getType());
+ // Clang 20 calls global operator delete after dtor call. Clang 21 and
newer
+ // call global operator delete inside of dtor body, as MSVC does.
+ bool Clang21AndNewer = CGF.getContext().getLangOpts().getClangABICompat() >
+ LangOptions::ClangABI::Ver20;
----------------
Fznamznon wrote:
Ok, I added a member to `TargetInfo` which seems to be easily available in both
Sema and CodeGen. Thanks.
https://github.com/llvm/llvm-project/pull/139566
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits