forked from OSchip/llvm-project
Fields of ivars of struct types are considered ivars
themselves for gc API generation purposes. llvm-svn: 59828
This commit is contained in:
parent
09075a99e0
commit
735a4158d9
|
@ -732,6 +732,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
|
||||||
|
|
||||||
LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
|
LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
|
||||||
bool isUnion = false;
|
bool isUnion = false;
|
||||||
|
bool isIvar = false;
|
||||||
Expr *BaseExpr = E->getBase();
|
Expr *BaseExpr = E->getBase();
|
||||||
llvm::Value *BaseValue = NULL;
|
llvm::Value *BaseValue = NULL;
|
||||||
unsigned CVRQualifiers=0;
|
unsigned CVRQualifiers=0;
|
||||||
|
@ -747,6 +748,8 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LValue BaseLV = EmitLValue(BaseExpr);
|
LValue BaseLV = EmitLValue(BaseExpr);
|
||||||
|
if (BaseLV.isObjCIvar())
|
||||||
|
isIvar = true;
|
||||||
// FIXME: this isn't right for bitfields.
|
// FIXME: this isn't right for bitfields.
|
||||||
BaseValue = BaseLV.getAddress();
|
BaseValue = BaseLV.getAddress();
|
||||||
if (BaseExpr->getType()->isUnionType())
|
if (BaseExpr->getType()->isUnionType())
|
||||||
|
@ -755,7 +758,9 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FieldDecl *Field = E->getMemberDecl();
|
FieldDecl *Field = E->getMemberDecl();
|
||||||
return EmitLValueForField(BaseValue, Field, isUnion, CVRQualifiers);
|
LValue MemExpLV = EmitLValueForField(BaseValue, Field, isUnion, CVRQualifiers);
|
||||||
|
LValue::SetObjCIvar(MemExpLV, isIvar);
|
||||||
|
return MemExpLV;
|
||||||
}
|
}
|
||||||
|
|
||||||
LValue CodeGenFunction::EmitLValueForField(llvm::Value* BaseValue,
|
LValue CodeGenFunction::EmitLValueForField(llvm::Value* BaseValue,
|
||||||
|
@ -937,7 +942,7 @@ LValue CodeGenFunction::EmitLValueForIvar(llvm::Value *BaseValue,
|
||||||
llvm::Value *V = Builder.CreateStructGEP(BaseValue, Index, "tmp");
|
llvm::Value *V = Builder.CreateStructGEP(BaseValue, Index, "tmp");
|
||||||
LValue LV = LValue::MakeAddr(V, Ivar->getType().getCVRQualifiers()|CVRQualifiers);
|
LValue LV = LValue::MakeAddr(V, Ivar->getType().getCVRQualifiers()|CVRQualifiers);
|
||||||
SetVarDeclObjCAttribute(getContext(), Ivar, Ivar->getType(), LV);
|
SetVarDeclObjCAttribute(getContext(), Ivar, Ivar->getType(), LV);
|
||||||
LValue::SetObjCIvar(LV);
|
LValue::SetObjCIvar(LV, true);
|
||||||
return LV;
|
return LV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,8 +168,8 @@ public:
|
||||||
bool isObjCWeak() const { return ObjCType == Weak; }
|
bool isObjCWeak() const { return ObjCType == Weak; }
|
||||||
bool isObjCStrong() const { return ObjCType == Strong; }
|
bool isObjCStrong() const { return ObjCType == Strong; }
|
||||||
|
|
||||||
static void SetObjCIvar(LValue& R) {
|
static void SetObjCIvar(LValue& R, bool iValue) {
|
||||||
R.Ivar = true;
|
R.Ivar = iValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetObjCType(bool isWeak, bool isStrong, LValue& R) {
|
static void SetObjCType(bool isWeak, bool isStrong, LValue& R) {
|
||||||
|
|
Loading…
Reference in New Issue