summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/ScopeInfo.cpp2
-rw-r--r--clang/test/SemaObjC/arc-repeated-weak.mm14
2 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Sema/ScopeInfo.cpp b/clang/lib/Sema/ScopeInfo.cpp
index 00d9982ac06..63ef3b2355f 100644
--- a/clang/lib/Sema/ScopeInfo.cpp
+++ b/clang/lib/Sema/ScopeInfo.cpp
@@ -176,6 +176,8 @@ void FunctionScopeInfo::markSafeWeakUse(const Expr *E) {
// Has this weak object been seen before?
FunctionScopeInfo::WeakObjectUseMap::iterator Uses;
if (const ObjCPropertyRefExpr *RefExpr = dyn_cast<ObjCPropertyRefExpr>(E)) {
+ if (!RefExpr->isObjectReceiver())
+ return;
if (isa<OpaqueValueExpr>(RefExpr->getBase()))
Uses = WeakObjectUses.find(WeakObjectProfileTy(RefExpr));
else {
diff --git a/clang/test/SemaObjC/arc-repeated-weak.mm b/clang/test/SemaObjC/arc-repeated-weak.mm
index 64df92a9afa..264c598942a 100644
--- a/clang/test/SemaObjC/arc-repeated-weak.mm
+++ b/clang/test/SemaObjC/arc-repeated-weak.mm
@@ -425,3 +425,17 @@ void doubleLevelAccessIvar(Test *a, Test *b) {
}
@end
+// rdar://19053620
+@interface NSNull
++ (NSNull *)null;
+@end
+
+@interface INTF @end
+
+@implementation INTF
+- (void) Meth : (id) data
+{
+ data = data ?: NSNull.null;
+}
+@end
+
OpenPOWER on IntegriCloud