summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-09-18 12:11:43 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-09-18 12:11:43 +0000
commit20104048be328324112cc40c4b9df8145182e375 (patch)
treed394bf14cf845768c24fa6952ef90a5d9afbd826 /clang/lib/CodeGen/CGClass.cpp
parent12d5ed8850aa3321ff0ecfd6d41d2c71db2efef5 (diff)
downloadbcm5719-llvm-20104048be328324112cc40c4b9df8145182e375.tar.gz
bcm5719-llvm-20104048be328324112cc40c4b9df8145182e375.zip
PR10304: Do not call destructors for data members from union destructors. Prior to C++11, this
has no effect since any such destructors must be trivial, and in C++11 such destructors must not be called. llvm-svn: 139997
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r--clang/lib/CodeGen/CGClass.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index 71cb13e9df3..615a4daa869 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -980,6 +980,10 @@ void CodeGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD,
const CXXRecordDecl *ClassDecl = DD->getParent();
+ // Unions have no bases and do not call field destructors.
+ if (ClassDecl->isUnion())
+ return;
+
// The complete-destructor phase just destructs all the virtual bases.
if (DtorType == Dtor_Complete) {
OpenPOWER on IntegriCloud