[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
Wed Mar 25 09:46:01 PDT 2026


================
@@ -1435,6 +1436,70 @@ static bool CanSkipVTablePointerInitialization(CodeGenFunction &CGF,
   return true;
 }
 
+/// Get or create the MSVC-compatible __global_delete wrapper function.
+///
+/// MSVC's scalar/vector deleting destructors call __global_delete (a weak
+/// external) instead of calling ::operator delete directly. This allows
+/// environments without a global ::operator delete (e.g., kernel mode) to
+/// gracefully fall back to a no-op __empty_global_delete.
+static llvm::Constant *
+getOrCreateMSVCGlobalDeleteWrapper(CodeGenModule &CGM,
----------------
dpaoliello wrote:

Sure, makes sense.

https://github.com/llvm/llvm-project/pull/188372


More information about the cfe-commits mailing list