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
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 0ac896c..4f2d47e 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1117,8 +1117,10 @@
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;
}