xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/method-def-1.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify -Wno-objc-root-class %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc@interface foo
4*f4a2713aSLionel Sambuc- (int)meth;
5*f4a2713aSLionel Sambuc@end
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuc@implementation foo
8*f4a2713aSLionel Sambuc- (int) meth { return [self meth]; }
9*f4a2713aSLionel Sambuc@end
10*f4a2713aSLionel Sambuc
11*f4a2713aSLionel Sambuc// PR2708
12*f4a2713aSLionel Sambuc@interface MyClass
13*f4a2713aSLionel Sambuc+- (void)myMethod;   // expected-error {{expected selector for Objective-C method}}
14*f4a2713aSLionel Sambuc- (vid)myMethod2;    // expected-error {{expected a type}}
15*f4a2713aSLionel Sambuc@end
16*f4a2713aSLionel Sambuc
17*f4a2713aSLionel Sambuc@implementation MyClass
18*f4a2713aSLionel Sambuc- (void)myMethod { }
19*f4a2713aSLionel Sambuc- (vid)myMethod2 { }	// expected-error {{expected a type}}
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambuc@end
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc@protocol proto;
25*f4a2713aSLionel Sambuc@protocol NSObject;
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambuc//@protocol GrowlPluginHandler <NSObject> @end
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambuc@interface SomeClass2
31*f4a2713aSLionel Sambuc- (int)myMethod1: (id<proto>)
32*f4a2713aSLionel Sambucarg; // expected-note {{previous definition is here}}
33*f4a2713aSLionel Sambuc@end
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc@implementation SomeClass2
36*f4a2713aSLionel Sambuc- (int)myMethod1: (id<NSObject>)
37*f4a2713aSLionel Sambuc  arg { // expected-warning {{conflicting parameter types in implementation of 'myMethod1:': 'id<proto>' vs 'id<NSObject>'}}
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc}
40*f4a2713aSLionel Sambuc@end
41