Also 'self' in blocks need be handled specially.

// rdar://9181463

llvm-svn: 128410
This commit is contained in:
Fariborz Jahanian 2011-03-28 16:23:34 +00:00
parent 87c19f61d4
commit d0d31bf263
2 changed files with 8 additions and 2 deletions

View File

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

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
// rdar://9181463
typedef struct objc_class *Class;
@ -14,6 +14,9 @@ typedef struct objc_object {
void foo(Class self) {
[self alloc];
(^() {
[self alloc];
})();
}
void bar(Class self) {