You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[win][clang] Align scalar deleting destructors with MSABI
While working on vector deleting destructors support (GH19772), I
noticed that MSVC produces different code in scalar deleting destructor
body depending on whether class defined its own operator delete.
In MSABI deleting destructors accept an additional implicit flag
parameter allowing some sort of flexibility. The mismatch I noticed is
that whenever a global operator delete is called, i.e. ::delete, in the
code produced by MSVC the implicit flag argument has a value that makes
the 3rd bit set, i.e. "5" for scalar deleting destructors "7" for vector
deleting destructors.
Prior to this patch, clang handled ::delete via calling global operator
delete direct after the destructor call and not calling class operator
delete in scalar deleting destructor body by passing "0" as implicit
flag argument value. This is fine until there is an attempt to link binaries
compiled with clang with binaries compiled with MSVC. The problem is that in
binaries produced by MSVC the callsite of the destructor won't call global
operator delete because it is assumed that the destructor will do that and a
destructor body generated by clang will never do.
This patch removes call to global operator delete from the callsite and
add additional check of the 3rd bit of the implicit parameter inside of
scalar deleting destructor body.
0 commit comments