]> granicus.if.org Git - clang/commit
When performing a ::delete of an object with a virtual destructor,
authorJohn McCall <rjmccall@apple.com>
Tue, 25 Sep 2012 10:10:39 +0000 (10:10 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 25 Sep 2012 10:10:39 +0000 (10:10 +0000)
commitecd03b447bb0e2ed1954c77441d49a4a17ca8138
treeb634a656ca4ac8a9086c5afdc2443c25faaf9f80
parent0e33dcda5c0f642da737c00e65bcdea6b988ce0b
When performing a ::delete of an object with a virtual destructor,
be sure to delete the complete object pointer, not the original
pointer.  This is necessary if the base being deleted is at a
non-zero offset in the complete object.  This is only required
for objects with virtual destructors because deleting an object
via a base-class subobject when the base does not have a virtual
destructor is undefined behavior.

Noticed while reviewing the last four years of cxx-abi-dev
activity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164597 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGCXXABI.h
lib/CodeGen/CGExprCXX.cpp
lib/CodeGen/ItaniumCXXABI.cpp
lib/CodeGen/MicrosoftCXXABI.cpp
test/CodeGenCXX/delete.cpp