annotate clang/test/SemaObjC/method-def-1.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify -Wno-objc-root-class %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 @interface foo
anatofuz
parents:
diff changeset
4 - (int)meth;
anatofuz
parents:
diff changeset
5 @end
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 @implementation foo
anatofuz
parents:
diff changeset
8 - (int) meth { return [self meth]; }
anatofuz
parents:
diff changeset
9 @end
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 // PR2708
anatofuz
parents:
diff changeset
12 @interface MyClass
anatofuz
parents:
diff changeset
13 +- (void)myMethod; // expected-error {{expected selector for Objective-C method}}
anatofuz
parents:
diff changeset
14 - (vid)myMethod2; // expected-error {{expected a type}}
anatofuz
parents:
diff changeset
15 @end
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 @implementation MyClass
anatofuz
parents:
diff changeset
18 - (void)myMethod { }
anatofuz
parents:
diff changeset
19 - (vid)myMethod2 { } // expected-error {{expected a type}}
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 @end
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 @protocol proto;
anatofuz
parents:
diff changeset
25 @protocol NSObject;
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 //@protocol GrowlPluginHandler <NSObject> @end
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 @interface SomeClass2
anatofuz
parents:
diff changeset
31 - (int)myMethod1: (id<proto>)
anatofuz
parents:
diff changeset
32 arg; // expected-note {{previous definition is here}}
anatofuz
parents:
diff changeset
33 @end
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 @implementation SomeClass2
anatofuz
parents:
diff changeset
36 - (int)myMethod1: (id<NSObject>)
anatofuz
parents:
diff changeset
37 arg { // expected-warning {{conflicting parameter types in implementation of 'myMethod1:': 'id<proto>' vs 'id<NSObject>'}}
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 }
anatofuz
parents:
diff changeset
40 @end