]> granicus.if.org Git - clang/commitdiff
assert(nyi) on attempt to destruct an array of objects.
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 3 Aug 2009 20:51:29 +0000 (20:51 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 3 Aug 2009 20:51:29 +0000 (20:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77993 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDecl.cpp

index 347a0af6968452f3a867d3f248e84a8e6a5706a0..bda3cf7e6f0033b5431317e6114e26516b74deca 100644 (file)
@@ -433,12 +433,16 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
   }
 
   // Handle CXX destruction of variables.
-  // FIXME - destruction of arrays NYI.
-  if (const RecordType *RT = Ty->getAs<RecordType>())
+  QualType DtorTy(Ty);
+  if (const ArrayType *Array = DtorTy->getAs<ArrayType>())
+    DtorTy = Array->getElementType();
+  if (const RecordType *RT = DtorTy->getAs<RecordType>())
     if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
       if (!ClassDecl->hasTrivialDestructor()) {
         const CXXDestructorDecl *D = ClassDecl->getDestructor(getContext());
         assert(D && "EmitLocalBlockVarDecl - destructor is nul");
+        assert(!Ty->getAs<ArrayType>() && "FIXME - destruction of arrays NYI");
+        
         CleanupScope scope(*this);
         EmitCXXDestructorCall(D, Dtor_Complete, DeclPtr);
       }