[Lldb-commits] [clang] [lldb] Reland [MS][clang] Add support for vector deleting destructors (PR #165598)

Mariya Podchishchaeva via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 21 08:42:59 PST 2025


Fznamznon wrote:

> But operator delete[] is an inline function, and with `/Zc:DllexportInlines-` it's not different from any other inline function: when it's used by a caller, clang should emit the definition.

Oh, I'm not sure it is that simple. There is `MarkDeclReferenced` and we don't call it for `operator delete[]` but adding this doesn't help.
The vector deleting destructor is emitted for `RefCountedTemplate<int>` but not for `Derived` due to the option. I don't see any definitions for any delete operators in the IR module that contains the vector deleting destructor i.e. object file for bar.cpp. I suppose this is due to the class marked extern but I'm not sure. I think the definition for scalar operator delete come from object file generated for foo.cpp . When compiling foo.cpp there is no `new[]` calls neither `dllexport`, so we don't generate vector deleting destructor for `RefCountedTemplate<int>`  there and `operator delete[]` is never emitted due to the option.

I think this can be fixed by skipping `/Zc:DllexportInlines-` effect on `operator delete[]` unconditionally when vector deleting destructors are enabled or either skipping the call to `operator delete[]` call in the vector deleting destructor body but given that it is EOD in my time zone and I'm on vacation next week, I'll prepare a revert to unblock for now and will work on bringing this back in December.

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


More information about the lldb-commits mailing list