xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/self-in-function.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1  -fsyntax-only -fblocks -verify %s
2*f4a2713aSLionel Sambuc// expected-no-diagnostics
3*f4a2713aSLionel Sambuc// rdar://9181463
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuctypedef struct objc_class *Class;
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuctypedef struct objc_object {
8*f4a2713aSLionel Sambuc    Class isa;
9*f4a2713aSLionel Sambuc} *id;
10*f4a2713aSLionel Sambuc
11*f4a2713aSLionel Sambuc@interface NSObject
12*f4a2713aSLionel Sambuc+ (id) alloc;
13*f4a2713aSLionel Sambuc@end
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambucvoid foo(Class self) {
17*f4a2713aSLionel Sambuc  [self alloc];
18*f4a2713aSLionel Sambuc  (^() {
19*f4a2713aSLionel Sambuc    [self alloc];
20*f4a2713aSLionel Sambuc   })();
21*f4a2713aSLionel Sambuc}
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel Sambucvoid bar(Class self) {
24*f4a2713aSLionel Sambuc  Class y = self;
25*f4a2713aSLionel Sambuc  [y alloc];
26*f4a2713aSLionel Sambuc}
27*f4a2713aSLionel Sambuc
28