'self' is objective-c's 'self' objc pointer only in
an objc method. Fixes // rdar://9181463 llvm-svn: 128389
This commit is contained in:
parent
8544228d5a
commit
b3b1e17645
|
@ -324,6 +324,9 @@ 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))
|
||||
return false;
|
||||
if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(RExpr))
|
||||
if (ICE->getCastKind() == CK_LValueToRValue)
|
||||
RExpr = ICE->getSubExpr();
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
// rdar://9181463
|
||||
|
||||
typedef struct objc_class *Class;
|
||||
|
||||
typedef struct objc_object {
|
||||
Class isa;
|
||||
} *id;
|
||||
|
||||
@interface NSObject
|
||||
+ (id) alloc;
|
||||
@end
|
||||
|
||||
|
||||
void foo(Class self) {
|
||||
[self alloc];
|
||||
}
|
||||
|
||||
void bar(Class self) {
|
||||
Class y = self;
|
||||
[y alloc];
|
||||
}
|
||||
|
Loading…
Reference in New Issue