Implement a few more cases for copy constructor synthesis.

llvm-svn: 88971
This commit is contained in:
Eli Friedman 2009-11-16 21:47:41 +00:00
parent 1b8fe5b716
commit c2ef215bda
2 changed files with 12 additions and 2 deletions

View File

@ -1381,8 +1381,16 @@ CodeGenFunction::SynthesizeCXXCopyConstructor(const CXXConstructorDecl *Ctor,
// Do a built-in assignment of scalar data members.
LValue LHS = EmitLValueForField(LoadOfThis, *Field, false, 0);
LValue RHS = EmitLValueForField(LoadOfSrc, *Field, false, 0);
RValue RVRHS = EmitLoadOfLValue(RHS, FieldType);
EmitStoreThroughLValue(RVRHS, LHS, FieldType);
if (!hasAggregateLLVMType(Field->getType())) {
RValue RVRHS = EmitLoadOfLValue(RHS, Field->getType());
EmitStoreThroughLValue(RVRHS, LHS, Field->getType());
} else if (Field->getType()->isAnyComplexType()) {
ComplexPairTy Pair = LoadComplexFromAddr(RHS.getAddress(),
RHS.isVolatileQualified());
StoreComplexToAddr(Pair, LHS.getAddress(), LHS.isVolatileQualified());
} else {
EmitAggregateCopy(LHS.getAddress(), RHS.getAddress(), Field->getType());
}
}
FinishFunction();
}

View File

@ -44,6 +44,8 @@ struct X : M, N, P { // ...
const char *name;
unsigned bf1 : 8;
unsigned bf2 : 16;
int arr[2];
_Complex float complex;
union {
int au_i1;