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)
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
// rdar://9181463
typedef struct objc_class *Class;
void foo(Class self) {
[self alloc];
+ (^() {
+ [self alloc];
+ })();
}
void bar(Class self) {