IRgen: The CVR qualifiers in a subobject adjustment should just come from the

field (I think).
 - Doug, please check.

llvm-svn: 111720
This commit is contained in:
Daniel Dunbar 2010-08-21 03:37:02 +00:00
parent b657ac51cf
commit e8b6cda15a
1 changed files with 10 additions and 16 deletions

View File

@ -146,10 +146,7 @@ struct SubobjectAdjustment {
const CXXRecordDecl *DerivedClass; const CXXRecordDecl *DerivedClass;
} DerivedToBase; } DerivedToBase;
struct { FieldDecl *Field;
FieldDecl *Field;
unsigned CVRQualifiers;
} Field;
}; };
SubobjectAdjustment(const CastExpr *BasePath, SubobjectAdjustment(const CastExpr *BasePath,
@ -160,11 +157,10 @@ struct SubobjectAdjustment {
DerivedToBase.DerivedClass = DerivedClass; DerivedToBase.DerivedClass = DerivedClass;
} }
SubobjectAdjustment(FieldDecl *Field, unsigned CVRQualifiers) SubobjectAdjustment(FieldDecl *Field)
: Kind(FieldAdjustment) : Kind(FieldAdjustment)
{ {
this->Field.Field = Field; this->Field = Field;
this->Field.CVRQualifiers = CVRQualifiers;
} }
}; };
@ -249,8 +245,7 @@ EmitExprForReferenceBinding(CodeGenFunction& CGF, const Expr* E,
ME->getBase()->getType()->isRecordType()) { ME->getBase()->getType()->isRecordType()) {
if (FieldDecl *Field = dyn_cast<FieldDecl>(ME->getMemberDecl())) { if (FieldDecl *Field = dyn_cast<FieldDecl>(ME->getMemberDecl())) {
E = ME->getBase(); E = ME->getBase();
Adjustments.push_back(SubobjectAdjustment(Field, Adjustments.push_back(SubobjectAdjustment(Field));
E->getType().getCVRQualifiers()));
continue; continue;
} }
} }
@ -296,9 +291,8 @@ EmitExprForReferenceBinding(CodeGenFunction& CGF, const Expr* E,
break; break;
case SubobjectAdjustment::FieldAdjustment: { case SubobjectAdjustment::FieldAdjustment: {
unsigned CVR = Adjustment.Field.CVRQualifiers;
LValue LV = LValue LV =
CGF.EmitLValueForField(Object, Adjustment.Field.Field, CVR); CGF.EmitLValueForField(Object, Adjustment.Field, 0);
if (LV.isSimple()) { if (LV.isSimple()) {
Object = LV.getAddress(); Object = LV.getAddress();
break; break;
@ -306,11 +300,11 @@ EmitExprForReferenceBinding(CodeGenFunction& CGF, const Expr* E,
// For non-simple lvalues, we actually have to create a copy of // For non-simple lvalues, we actually have to create a copy of
// the object we're binding to. // the object we're binding to.
QualType T = Adjustment.Field.Field->getType().getNonReferenceType() QualType T = Adjustment.Field->getType().getNonReferenceType()
.getUnqualifiedType(); .getUnqualifiedType();
Object = CreateReferenceTemporary(CGF, T, InitializedDecl); Object = CreateReferenceTemporary(CGF, T, InitializedDecl);
LValue TempLV = LValue::MakeAddr(Object, LValue TempLV = CGF.MakeAddrLValue(Object,
Qualifiers::fromCVRMask(CVR)); Adjustment.Field->getType());
CGF.EmitStoreThroughLValue(CGF.EmitLoadOfLValue(LV, T), TempLV, T); CGF.EmitStoreThroughLValue(CGF.EmitLoadOfLValue(LV, T), TempLV, T);
break; break;
} }