diff options
author | John McCall <rjmccall@apple.com> | 2011-02-13 00:46:43 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-13 00:46:43 +0000 |
commit | 0d70d71ccbc4f7f59cadb759f61b7172a149676c (patch) | |
tree | 027a6fb58fc309c2111963092aef4742f3cdf731 /lib/CodeGen | |
parent | e3c8c64e7735c3589e1a34e6000c93183a55920c (diff) |
Look through array types when deciding whether a field requires non-trivial
destruction in the destructor-aliases logic. Fixes PR 9197.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125447 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index d4bd9cbc9a..7ffc6e7325 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -60,13 +60,12 @@ bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) { return true; } - // If any fields have a non-trivial destructor, we have to emit it - // separately. + // If any field has a non-trivial destructor, we have to emit the + // destructor separately. for (CXXRecordDecl::field_iterator I = Class->field_begin(), E = Class->field_end(); I != E; ++I) - if (const RecordType *RT = (*I)->getType()->getAs<RecordType>()) - if (!cast<CXXRecordDecl>(RT->getDecl())->hasTrivialDestructor()) - return true; + if ((*I)->getType().isDestructedType()) + return true; // Try to find a unique base class with a non-trivial destructor. const CXXRecordDecl *UniqueBase = 0; |