xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/method_pool.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: rm -rf %t
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -I %S/Inputs %s -verify
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc@import MethodPoolA;
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuc@interface D
8*f4a2713aSLionel Sambuc- (void)method5:(D*)obj;
9*f4a2713aSLionel Sambuc@end
10*f4a2713aSLionel Sambuc
11*f4a2713aSLionel Sambuc// expected-note@Inputs/MethodPoolA.h:7{{using}}
12*f4a2713aSLionel Sambuc// expected-note@Inputs/MethodPoolB.h:12{{also found}}
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambucvoid testMethod1(id object) {
15*f4a2713aSLionel Sambuc  [object method1];
16*f4a2713aSLionel Sambuc}
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambucvoid testMethod2(id object) {
19*f4a2713aSLionel Sambuc  [object method2:1];
20*f4a2713aSLionel Sambuc}
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambucvoid testMethod4(id object) {
23*f4a2713aSLionel Sambuc  [object method4]; // expected-warning{{instance method '-method4' not found (return type defaults to 'id')}}
24*f4a2713aSLionel Sambuc}
25*f4a2713aSLionel Sambuc
26*f4a2713aSLionel Sambucvoid testMethod5(id object, D* d) {
27*f4a2713aSLionel Sambuc  [object method5:d];
28*f4a2713aSLionel Sambuc}
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambuc@import MethodPoolB;
31*f4a2713aSLionel Sambuc
32*f4a2713aSLionel Sambucvoid testMethod1Again(id object) {
33*f4a2713aSLionel Sambuc  [object method1];
34*f4a2713aSLionel Sambuc}
35*f4a2713aSLionel Sambuc
36*f4a2713aSLionel Sambucvoid testMethod2Again(id object) {
37*f4a2713aSLionel Sambuc  [object method2:1]; // expected-warning{{multiple methods named 'method2:' found}}
38*f4a2713aSLionel Sambuc}
39*f4a2713aSLionel Sambuc
40*f4a2713aSLionel Sambucvoid testMethod3(id object) {
41*f4a2713aSLionel Sambuc  [object method3]; // expected-warning{{instance method '-method3' not found (return type defaults to 'id')}}
42*f4a2713aSLionel Sambuc}
43*f4a2713aSLionel Sambuc
44*f4a2713aSLionel Sambuc@import MethodPoolB.Sub;
45*f4a2713aSLionel Sambuc
46*f4a2713aSLionel Sambucvoid testMethod3Again(id object) {
47*f4a2713aSLionel Sambuc  char *str = [object method3]; // okay: only found in MethodPoolB.Sub
48*f4a2713aSLionel Sambuc}
49*f4a2713aSLionel Sambuc
50*f4a2713aSLionel Sambucvoid testMethod6(id object) {
51*f4a2713aSLionel Sambuc  [object method6];
52*f4a2713aSLionel Sambuc}
53*f4a2713aSLionel Sambuc
54*f4a2713aSLionel Sambuc@import MethodPoolA.Sub;
55*f4a2713aSLionel Sambuc
56*f4a2713aSLionel Sambucvoid testMethod3AgainAgain(id object) {
57*f4a2713aSLionel Sambuc  [object method3]; // expected-warning{{multiple methods named 'method3' found}}
58*f4a2713aSLionel Sambuc  // expected-note@Inputs/MethodPoolBSub.h:2{{using}}
59*f4a2713aSLionel Sambuc  // expected-note@Inputs/MethodPoolASub.h:2{{also found}}
60*f4a2713aSLionel Sambuc}
61*f4a2713aSLionel Sambuc
62*f4a2713aSLionel Sambucvoid testMethod4Again(id object) {
63*f4a2713aSLionel Sambuc  [object method4];
64*f4a2713aSLionel Sambuc}
65*f4a2713aSLionel Sambuc
66*f4a2713aSLionel Sambucvoid testMethod5Again(id object, D* d) {
67*f4a2713aSLionel Sambuc  [object method5:d];
68*f4a2713aSLionel Sambuc}
69