diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-18 00:04:00 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-18 00:04:00 +0000 |
commit | 1c1afc4ed3ec30fc99e172220c8bb74a13b117b0 (patch) | |
tree | b487019662b268b713bdd162aa13767dfed63108 /lib/CodeGen/CGExpr.cpp | |
parent | 87667dcbc1301409c9c07a3f6281a2c496997649 (diff) |
Fixed a bug in generation of the new write-barriers when
array syntax is used to derefernce and assign to ivar pointee.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index fa3e492416..43224bb424 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -697,6 +697,7 @@ void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, LValue &LV) { if (isa<ObjCIvarRefExpr>(E)) { LV.SetObjCIvar(LV, true); + LV.SetObjCIvarArray(LV, E->getType()->isArrayType()); return; } if (const DeclRefExpr *Exp = dyn_cast<DeclRefExpr>(E)) { @@ -714,10 +715,19 @@ void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, LValue &LV) { setObjCGCLValueClass(Ctx, Exp->getSubExpr(), LV); else if (const CStyleCastExpr *Exp = dyn_cast<CStyleCastExpr>(E)) setObjCGCLValueClass(Ctx, Exp->getSubExpr(), LV); - else if (const ArraySubscriptExpr *Exp = dyn_cast<ArraySubscriptExpr>(E)) + else if (const ArraySubscriptExpr *Exp = dyn_cast<ArraySubscriptExpr>(E)) { setObjCGCLValueClass(Ctx, Exp->getBase(), LV); + if (LV.isObjCIvar() && !LV.isObjCIvarArray()) { + // Using array syntax to assigning to what an ivar points to is not + // same as assigning to the ivar itself. {id *Names;} Names[i] = 0; + LV.SetObjCIvar(LV, false); + } + } else if (const MemberExpr *Exp = dyn_cast<MemberExpr>(E)) { setObjCGCLValueClass(Ctx, Exp->getBase(), LV); + // We don't know if member is an 'ivar', but this flag is looked at + // only in the context of LV.isObjCIvar(). + LV.SetObjCIvarArray(LV, E->getType()->isArrayType()); } } |