Objective-C ARC. Fixes a crash when checking for 'weak' propery

whose base is not an expression. rdar://19053620

llvm-svn: 222570
This commit is contained in:
Fariborz Jahanian 2014-11-21 21:12:11 +00:00
parent 6f3150a7d2
commit ac1c5120c6
2 changed files with 16 additions and 0 deletions

View File

@ -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 {

View File

@ -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