Fix <rdar://problem/6320086> parser rejects block capturing ivar.

llvm-svn: 59444
This commit is contained in:
Steve Naroff 2008-11-17 16:28:52 +00:00
parent d69246bd5b
commit ecf2bb8724
2 changed files with 23 additions and 1 deletions

View File

@ -241,5 +241,8 @@ const LangOptions &Sema::getLangOptions() const {
}
ObjCMethodDecl *Sema::getCurMethodDecl() {
return dyn_cast<ObjCMethodDecl>(CurContext);
DeclContext *DC = CurContext;
while (isa<BlockDecl>(DC))
DC = DC->getParent();
return dyn_cast<ObjCMethodDecl>(DC);
}

View File

@ -0,0 +1,19 @@
// RUN: clang -fsyntax-only -verify %s
@interface NSObject {
struct objc_object *isa;
}
@end
@interface Foo : NSObject {
int _prop;
}
@end
@implementation Foo
- (int)doSomething {
int (^blk)(void) = ^{ return _prop; };
return blk();
}
@end