[PATCH] [ms-cxxabi] Add basic support for vector deleting destructors.

Peter Collingbourne peter at pcc.me.uk
Sun May 19 15:26:50 PDT 2013


Hi timurrrr,

These destructors are used by cl.exe to implement polymorphic delete[],
a language extension which we don't support (yet).  However, we
are forced by the ABI to implement some support for them.  This is
because cl.exe, when compiling delete[] with a parameter of pointer to
dynamic class type, will emit a call to the vector deleting destructor
via the vftable.  Unless we implement the correct semantics for this
destructor, the wrong number of objects will be deleted and the wrong
memory address will be freed.

To begin with, place a reference to the vector deleting dtor in the
vtable (instead of the scalar deleting dtor), and emit the vector
deleting dtor as a weak alias of the scalar deleting dtor.  This is
what cl.exe does when the TU does not contain a new[] expression for
that class type.  We don't actually emit the definition of the vector
deleting dtor yet, that will be done in a later change.

http://llvm-reviews.chandlerc.com/D824

Files:
  include/clang/Basic/ABI.h
  lib/AST/ItaniumMangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/AST/VTableBuilder.cpp
  lib/CodeGen/CGCXX.cpp
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CGVTables.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/CodeGen/MicrosoftCXXABI.cpp
  test/CodeGenCXX/microsoft-abi-structors.cpp
  test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D824.1.patch
Type: text/x-patch
Size: 13417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130519/ffdcf322/attachment.bin>


More information about the cfe-commits mailing list