aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-09-16 18:09:18 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-09-16 18:09:18 +0000
commit59a53fa3f8ea73bae52ea36d0038f76e9f10729c (patch)
tree8f09f43089f27dc411f3def9de67f40e0994aa50 /lib
parent8e674aea310ab0f79e02973857f63c2dd695202c (diff)
Do not generate write-barrier in indirect assignment to
a weak object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/Expr.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 0ac896c783..4f2d47ec2f 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1117,8 +1117,10 @@ bool Expr::isOBJCGCCandidate(ASTContext &Ctx) const {
if (VD->hasGlobalStorage())
return true;
QualType T = VD->getType();
- // dereferencing to a pointer is always a gc'able candidate
- return T->isPointerType();
+ // dereferencing to a pointer is always a gc'able candidate,
+ // unless it is __weak.
+ return T->isPointerType() &&
+ (Ctx.getObjCGCAttrKind(T) != QualType::Weak);
}
return false;
}