annotate clang/test/SemaObjC/class-method-lookup.m @ 180:680fa57a2f20

fix compile errors.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 30 May 2020 17:44:06 +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 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 @interface MyBase
anatofuz
parents:
diff changeset
4 - (void) rootInstanceMethod;
anatofuz
parents:
diff changeset
5 @end
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 @interface MyIntermediate: MyBase
anatofuz
parents:
diff changeset
8 @end
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 @interface MyDerived: MyIntermediate
anatofuz
parents:
diff changeset
11 - (void) instanceMethod;
anatofuz
parents:
diff changeset
12 + (void) classMethod;
anatofuz
parents:
diff changeset
13 @end
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 @implementation MyDerived
anatofuz
parents:
diff changeset
16 - (void) instanceMethod {
anatofuz
parents:
diff changeset
17 }
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 + (void) classMethod { /* If a class method is not found, the root */
anatofuz
parents:
diff changeset
20 [self rootInstanceMethod]; /* class is searched for an instance method */
anatofuz
parents:
diff changeset
21 [MyIntermediate rootInstanceMethod]; /* with the same name. */
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 [self instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
anatofuz
parents:
diff changeset
24 [MyDerived instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
anatofuz
parents:
diff changeset
25 }
anatofuz
parents:
diff changeset
26 @end
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 @interface Object @end
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 @interface Class1
anatofuz
parents:
diff changeset
31 - (void)setWindow:(Object *)wdw;
anatofuz
parents:
diff changeset
32 @end
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 @interface Class2
anatofuz
parents:
diff changeset
35 - (void)setWindow:(Class1 *)window;
anatofuz
parents:
diff changeset
36 @end
anatofuz
parents:
diff changeset
37
anatofuz
parents:
diff changeset
38 #define nil (void*)0
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40 id foo(void) {
anatofuz
parents:
diff changeset
41 Object *obj;
anatofuz
parents:
diff changeset
42 id obj2 = obj;
anatofuz
parents:
diff changeset
43 [obj setWindow:nil]; // expected-warning {{'Object' may not respond to 'setWindow:'}}
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 return obj;
anatofuz
parents:
diff changeset
46 }