ir-gen support for anonymous union data member

copying in copy constructors and used in
default constructor's initializer list.

llvm-svn: 78700
This commit is contained in:
Fariborz Jahanian
2009-08-11 18:49:54 +00:00
parent d362857f4c
commit b2197042b8
6 changed files with 74 additions and 18 deletions

View File

@@ -699,14 +699,14 @@ void CodeGenModule::DeferredCopyConstructorToEmit(GlobalDecl CopyCtorDecl) {
for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
FieldEnd = ClassDecl->field_end();
Field != FieldEnd; ++Field) {
assert(!(*Field)->isAnonymousStructOrUnion() &&
"FIXME. Anonymous union NYI - DeferredCopyConstructorToEmit");
QualType FieldType = Context.getCanonicalType((*Field)->getType());
if (const ArrayType *Array = Context.getAsArrayType(FieldType))
FieldType = Array->getElementType();
if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
if ((*Field)->isAnonymousStructOrUnion())
continue;
CXXRecordDecl *FieldClassDecl
= cast<CXXRecordDecl>(FieldClassType->getDecl());
= cast<CXXRecordDecl>(FieldClassType->getDecl());
if (CXXConstructorDecl *FieldCopyCtor =
FieldClassDecl->getCopyConstructor(Context, 0))
GetAddrOfCXXConstructor(FieldCopyCtor, Ctor_Complete);