[clang] [clang][win] MSVC-compat: Use `__global_delete` wrapper in deleting destructors instead of directly referencing `::operator delete` (PR #188372)
Daniel Paoliello via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 14 09:47:20 PDT 2026
================
@@ -2069,6 +2072,12 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) {
const Expr *Arg = E->getArgument();
Address Ptr = EmitPointerWithAlignment(Arg);
+ // If this delete expression uses global ::operator delete (not a
+ // class-specific one), note it so we emit __global_delete forwarding bodies.
+ if (!isa<CXXMethodDecl>(E->getOperatorDelete()) &&
+ CGM.getTarget().getCXXABI().isMicrosoft())
+ CGM.noteDirectGlobalDelete();
----------------
dpaoliello wrote:
Good call - fixed these and checked MSVC's behavior for other corner cases as well.
https://github.com/llvm/llvm-project/pull/188372
More information about the cfe-commits
mailing list