A number of array-related IR-gen cleanups.

- Emit default-initialization of arrays that were partially initialized
    with initializer lists with a loop, rather than emitting the default
    initializer N times;
  - support destroying VLAs of non-trivial type, although this is not
    yet exposed to users; and
  - support the partial destruction of arrays initialized with
    initializer lists when an initializer throws an exception.

llvm-svn: 134784
This commit is contained in:
John McCall
2011-07-09 01:37:26 +00:00
parent f023519770
commit 82fe67bb82
10 changed files with 617 additions and 287 deletions

View File

@@ -1172,6 +1172,17 @@ CodeGenFunction::EmitCXXAggrConstructorCall(const CXXConstructorDecl *D,
EmitBlock(AfterFor, true);
}
void CodeGenFunction::destroyCXXObject(CodeGenFunction &CGF,
llvm::Value *addr,
QualType type) {
const RecordType *rtype = type->castAs<RecordType>();
const CXXRecordDecl *record = cast<CXXRecordDecl>(rtype->getDecl());
const CXXDestructorDecl *dtor = record->getDestructor();
assert(!dtor->isTrivial());
CGF.EmitCXXDestructorCall(dtor, Dtor_Complete, /*for vbase*/ false,
addr);
}
/// EmitCXXAggrDestructorCall - calls the default destructor on array
/// elements in reverse order of construction.
void