Fix <rdar://problem/6320086> parser rejects block capturing ivar.
llvm-svn: 59444
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
19
clang/test/SemaObjC/block-ivar.m
Normal file
19
clang/test/SemaObjC/block-ivar.m
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user