summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/ScopeInfo.cpp2
-rw-r--r--clang/test/SemaObjC/arc-repeated-weak.mm12
2 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Sema/ScopeInfo.cpp b/clang/lib/Sema/ScopeInfo.cpp
index c1d66299058..4d29a34a73e 100644
--- a/clang/lib/Sema/ScopeInfo.cpp
+++ b/clang/lib/Sema/ScopeInfo.cpp
@@ -159,7 +159,7 @@ void FunctionScopeInfo::markSafeWeakUse(const Expr *E) {
Uses = WeakObjectUses.find(WeakObjectProfileTy(IvarE));
else if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
Uses = WeakObjectUses.find(WeakObjectProfileTy(DRE));
- else if (const ObjCMessageExpr *MsgE = dyn_cast<ObjCMessageExpr>(MsgE)) {
+ else if (const ObjCMessageExpr *MsgE = dyn_cast<ObjCMessageExpr>(E)) {
Uses = WeakObjectUses.end();
if (const ObjCMethodDecl *MD = MsgE->getMethodDecl()) {
if (const ObjCPropertyDecl *Prop = MD->findPropertyDecl()) {
diff --git a/clang/test/SemaObjC/arc-repeated-weak.mm b/clang/test/SemaObjC/arc-repeated-weak.mm
index a59f435693d..1539a9bcae0 100644
--- a/clang/test/SemaObjC/arc-repeated-weak.mm
+++ b/clang/test/SemaObjC/arc-repeated-weak.mm
@@ -181,6 +181,18 @@ void assignToStrongWithCasts(Test *a) {
}
}
+void assignToStrongWithMessages(Test *a) {
+ if (condition()) {
+ id val = [a weakProp]; // no-warning
+ (void)val;
+ } else {
+ id val;
+ val = [a weakProp]; // no-warning
+ (void)val;
+ }
+}
+
+
void assignAfterRead(Test *a) {
// Special exception for a single read before any writes.
if (!a.weakProp) // no-warning
OpenPOWER on IntegriCloud