diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 22a1b19921..cf38225de0 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -325,7 +325,10 @@ bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs, bool Sema::isSelfExpr(Expr *RExpr) { // 'self' is objc 'self' in an objc method only. - if (!isa<ObjCMethodDecl>(CurContext)) + DeclContext *DC = CurContext; + while (isa<BlockDecl>(DC)) + DC = DC->getParent(); + if (DC && !isa<ObjCMethodDecl>(DC)) return false; if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(RExpr)) if (ICE->getCastKind() == CK_LValueToRValue) |