forked from OSchip/llvm-project
Also 'self' in blocks need be handled specially.
// rdar://9181463 llvm-svn: 128410
This commit is contained in:
parent
87c19f61d4
commit
d0d31bf263
|
@ -325,7 +325,10 @@ bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs,
|
||||||
|
|
||||||
bool Sema::isSelfExpr(Expr *RExpr) {
|
bool Sema::isSelfExpr(Expr *RExpr) {
|
||||||
// 'self' is objc 'self' in an objc method only.
|
// '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;
|
return false;
|
||||||
if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(RExpr))
|
if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(RExpr))
|
||||||
if (ICE->getCastKind() == CK_LValueToRValue)
|
if (ICE->getCastKind() == CK_LValueToRValue)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
|
||||||
// rdar://9181463
|
// rdar://9181463
|
||||||
|
|
||||||
typedef struct objc_class *Class;
|
typedef struct objc_class *Class;
|
||||||
|
@ -14,6 +14,9 @@ typedef struct objc_object {
|
||||||
|
|
||||||
void foo(Class self) {
|
void foo(Class self) {
|
||||||
[self alloc];
|
[self alloc];
|
||||||
|
(^() {
|
||||||
|
[self alloc];
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
void bar(Class self) {
|
void bar(Class self) {
|
||||||
|
|
Loading…
Reference in New Issue