[PATCH] MS ABI: Properly call global delete when invoking virtual destructors

David Majnemer david.majnemer at gmail.com
Sun Oct 26 13:01:09 PDT 2014


Hi rnk,

The Itanium ABI approach of using offset-to-top isn't possible with the
MS ABI, it doesn't have that kind of information lying around.

Instead, we do the following:
- Call the virtual deleting destructor with the "don't delete the object
  flag" set.  The virtual deleting destructor will return a pointer to
  'this' adjusted to the most derived class.
- Call the global delete using the adjusted 'this' pointer.

http://reviews.llvm.org/D5996

Files:
  lib/CodeGen/CGCXXABI.h
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGExprCXX.cpp
  lib/CodeGen/CGVTables.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  test/CodeGenCXX/dllexport.cpp
  test/CodeGenCXX/microsoft-abi-structors.cpp
  test/CodeGenCXX/microsoft-abi-thunks.cpp
  test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5996.15469.patch
Type: text/x-patch
Size: 37242 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141026/8424b17d/attachment.bin>


More information about the cfe-commits mailing list