summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-09-30 17:10:29 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-09-30 17:10:29 +0000
commite01e434aef4fd3190928f7e47331e6cb7f474e73 (patch)
treefe250e1cd8e0c308578480dfae74f71be176ca68 /clang/lib/CodeGen
parente0527b2de123ada4a9dce92ce14528b326eec30a (diff)
downloadbcm5719-llvm-e01e434aef4fd3190928f7e47331e6cb7f474e73.tar.gz
bcm5719-llvm-e01e434aef4fd3190928f7e47331e6cb7f474e73.zip
<rdar://problem/7263113> Make clang produce gcc's objc_assign_StrongCast as a result of type-cast of an ivar in assignment.
llvm-svn: 83150
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index af8363dbb11..d89da3224fc 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -719,8 +719,18 @@ void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, LValue &LV) {
}
else if (const UnaryOperator *Exp = dyn_cast<UnaryOperator>(E))
setObjCGCLValueClass(Ctx, Exp->getSubExpr(), LV);
- else if (const ParenExpr *Exp = dyn_cast<ParenExpr>(E))
+ else if (const ParenExpr *Exp = dyn_cast<ParenExpr>(E)) {
setObjCGCLValueClass(Ctx, Exp->getSubExpr(), LV);
+ if (LV.isObjCIvar()) {
+ // If cast is to a structure pointer, follow gcc's behavior and make it
+ // a non-ivar write-barrier.
+ QualType ExpTy = E->getType();
+ if (ExpTy->isPointerType())
+ ExpTy = ExpTy->getAs<PointerType>()->getPointeeType();
+ if (ExpTy->isRecordType())
+ LV.SetObjCIvar(LV, false);
+ }
+ }
else if (const ImplicitCastExpr *Exp = dyn_cast<ImplicitCastExpr>(E))
setObjCGCLValueClass(Ctx, Exp->getSubExpr(), LV);
else if (const CStyleCastExpr *Exp = dyn_cast<CStyleCastExpr>(E))
OpenPOWER on IntegriCloud