Support for anonymous union in ctor's initializer and
bunch of FIXMEs for their is-gen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78623 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 417dcf7..18c06cf 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -855,7 +855,8 @@
// FIXME. How about copying arrays!
assert(!getContext().getAsArrayType(FieldType) &&
"FIXME. Copying arrays NYI");
-
+ assert(!Field->isAnonymousStructOrUnion() &&
+ "FIXME. anonymous data member NYI in copy constructor synthesis");
if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
CXXRecordDecl *FieldClassDecl
= cast<CXXRecordDecl>(FieldClassType->getDecl());
@@ -904,7 +905,12 @@
QualType FieldType = getContext().getCanonicalType((Field)->getType());
assert(!getContext().getAsArrayType(FieldType)
&& "FIXME. Field arrays initialization unsupported");
-
+ DeclContext *Ctx = Field->getDeclContext();
+ RecordDecl *Record = cast<RecordDecl>(Ctx);
+ assert(!Record->isAnonymousStructOrUnion() &&
+ "FIXME. anonymous union initializer NYI in default constructor");
+ (void)Record;
+
LoadOfThis = LoadCXXThis();
LValue LHS = EmitLValueForField(LoadOfThis, Field, false, 0);
if (FieldType->getAs<RecordType>()) {
@@ -921,10 +927,7 @@
assert(Member->getNumArgs() == 1 && "Initializer count must be 1 only");
Expr *RhsExpr = *Member->arg_begin();
llvm::Value *RHS = EmitScalarExpr(RhsExpr, true);
- if (LHS.isBitfield())
- EmitStoreThroughBitfieldLValue(RValue::get(RHS), LHS, FieldType, 0);
- else
- EmitStoreThroughLValue(RValue::get(RHS), LHS, FieldType);
+ EmitStoreThroughLValue(RValue::get(RHS), LHS, FieldType);
}
}
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index df9b341..59f44de 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -699,6 +699,8 @@
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();