r222570 - Objective-C ARC. Fixes a crash when checking for 'weak' propery
Fariborz Jahanian
fjahanian at apple.com
Fri Nov 21 13:12:12 PST 2014
Author: fjahanian
Date: Fri Nov 21 15:12:11 2014
New Revision: 222570
URL: http://llvm.org/viewvc/llvm-project?rev=222570&view=rev
Log:
Objective-C ARC. Fixes a crash when checking for 'weak' propery
whose base is not an expression. rdar://19053620
Modified:
cfe/trunk/lib/Sema/ScopeInfo.cpp
cfe/trunk/test/SemaObjC/arc-repeated-weak.mm
Modified: cfe/trunk/lib/Sema/ScopeInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/ScopeInfo.cpp?rev=222570&r1=222569&r2=222570&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/ScopeInfo.cpp (original)
+++ cfe/trunk/lib/Sema/ScopeInfo.cpp Fri Nov 21 15:12:11 2014
@@ -176,6 +176,8 @@ void FunctionScopeInfo::markSafeWeakUse(
// 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 {
Modified: cfe/trunk/test/SemaObjC/arc-repeated-weak.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-repeated-weak.mm?rev=222570&r1=222569&r2=222570&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-repeated-weak.mm (original)
+++ cfe/trunk/test/SemaObjC/arc-repeated-weak.mm Fri Nov 21 15:12:11 2014
@@ -425,3 +425,17 @@ void doubleLevelAccessIvar(Test *a, Test
}
@end
+// rdar://19053620
+ at interface NSNull
++ (NSNull *)null;
+ at end
+
+ at interface INTF @end
+
+ at implementation INTF
+- (void) Meth : (id) data
+{
+ data = data ?: NSNull.null;
+}
+ at end
+
More information about the cfe-commits
mailing list