From 2b3c5538fa26f5301d4498b8d6c8949d68aa20c2 Mon Sep 17 00:00:00 2001 From: John McCall Date: Sun, 13 Feb 2011 00:46:43 +0000 Subject: Look through array types when deciding whether a field requires non-trivial destruction in the destructor-aliases logic. Fixes PR 9197. llvm-svn: 125447 --- clang/lib/CodeGen/CGCXX.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index d4bd9cbc9ab..7ffc6e73255 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/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()) - if (!cast(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; -- cgit v1.2.3