Delay codegen to after collecting all SubobjectAdjustment so that the collection

can be refactored and used in Sema.

llvm-svn: 166847
This commit is contained in:
Rafael Espindola 2012-10-27 00:36:38 +00:00
parent ac8c669985
commit e7b11f5241
1 changed files with 6 additions and 6 deletions

View File

@ -177,7 +177,7 @@ namespace {
struct {
const MemberPointerType *MPT;
llvm::Value *Ptr;
Expr *RHS;
} Ptr;
};
@ -193,10 +193,10 @@ namespace {
this->Field = Field;
}
SubobjectAdjustment(const MemberPointerType *MPT, llvm::Value *Ptr)
SubobjectAdjustment(const MemberPointerType *MPT, Expr *RHS)
: Kind(MemberPointerAdjustment) {
this->Ptr.MPT = MPT;
this->Ptr.Ptr = Ptr;
this->Ptr.RHS = RHS;
}
};
}
@ -371,8 +371,7 @@ EmitExprForReferenceBinding(CodeGenFunction &CGF, const Expr *E,
E = BO->getLHS();
const MemberPointerType *MPT =
BO->getRHS()->getType()->getAs<MemberPointerType>();
llvm::Value *Ptr = CGF.EmitScalarExpr(BO->getRHS());
Adjustments.push_back(SubobjectAdjustment(MPT, Ptr));
Adjustments.push_back(SubobjectAdjustment(MPT, BO->getRHS()));
}
}
@ -447,8 +446,9 @@ EmitExprForReferenceBinding(CodeGenFunction &CGF, const Expr *E,
}
case SubobjectAdjustment::MemberPointerAdjustment: {
llvm::Value *Ptr = CGF.EmitScalarExpr(Adjustment.Ptr.RHS);
Object = CGF.CGM.getCXXABI().EmitMemberDataPointerAddress(
CGF, Object, Adjustment.Ptr.Ptr, Adjustment.Ptr.MPT);
CGF, Object, Ptr, Adjustment.Ptr.MPT);
break;
}
}