Use EmitLValueForFieldInitialization when synthesizing the copy ctor as well.

llvm-svn: 94800
This commit is contained in:
Anders Carlsson
2010-01-29 05:41:25 +00:00
parent db78f0ad04
commit 42c876dff2

View File

@@ -647,26 +647,9 @@ CodeGenFunction::SynthesizeCXXCopyConstructor(const CXXConstructorDecl *Ctor,
continue;
}
if (Field->getType()->isReferenceType()) {
unsigned FieldIndex = CGM.getTypes().getLLVMFieldNo(Field);
llvm::Value *LHS = Builder.CreateStructGEP(LoadOfThis, FieldIndex,
"lhs.ref");
llvm::Value *RHS = Builder.CreateStructGEP(LoadOfThis, FieldIndex,
"rhs.ref");
// Load the value in RHS.
RHS = Builder.CreateLoad(RHS);
// And store it in the LHS
Builder.CreateStore(RHS, LHS);
continue;
}
// Do a built-in assignment of scalar data members.
LValue LHS = EmitLValueForField(LoadOfThis, Field, 0);
LValue RHS = EmitLValueForField(LoadOfSrc, Field, 0);
LValue LHS = EmitLValueForFieldInitialization(LoadOfThis, Field, 0);
LValue RHS = EmitLValueForFieldInitialization(LoadOfSrc, Field, 0);
if (!hasAggregateLLVMType(Field->getType())) {
RValue RVRHS = EmitLoadOfLValue(RHS, Field->getType());