diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-26 09:11:52 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-26 09:11:52 +0000 |
commit | 921bd20dddf5080cdb36f39c0162eb63b2d5325e (patch) | |
tree | 8a00bb24a57086351d6591c9be484e55a727543e /clang/lib/CodeGen/CGClass.cpp | |
parent | af3c2090b4158f9ed56320553d10506e9838cb6e (diff) | |
download | llvm-921bd20dddf5080cdb36f39c0162eb63b2d5325e.zip llvm-921bd20dddf5080cdb36f39c0162eb63b2d5325e.tar.gz llvm-921bd20dddf5080cdb36f39c0162eb63b2d5325e.tar.bz2 |
Ensure that we delete destructors in the right cases. Specifically:
- variant members with nontrivial destructors make the containing class's
destructor deleted
- check for a virtual destructor after checking for overridden methods in the
base class(es)
- check for an inaccessible operator delete for a class with a virtual
destructor.
Do not try to call an anonymous union field's destructor from the destructor of
the containing class.
llvm-svn: 151483
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 618a3f8..b9abbf2 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -1062,6 +1062,10 @@ void CodeGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, QualType::DestructionKind dtorKind = type.isDestructedType(); if (!dtorKind) continue; + // Anonymous union members do not have their destructors called. + const RecordType *RT = type->getAsUnionType(); + if (RT && RT->getDecl()->isAnonymousStructOrUnion()) continue; + CleanupKind cleanupKind = getCleanupKind(dtorKind); EHStack.pushCleanup<DestroyField>(cleanupKind, field, getDestroyer(dtorKind), |