File: method-lookup-3.m

package info (click to toggle)
llvm-toolchain-3.4 1%3A3.4.2-13
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 253,236 kB
  • ctags: 276,203
  • sloc: cpp: 1,665,580; ansic: 298,647; asm: 206,157; objc: 84,350; python: 73,119; sh: 23,466; perl: 5,679; makefile: 5,542; ml: 5,250; pascal: 2,467; lisp: 1,420; xml: 679; cs: 236; csh: 117
file content (73 lines) | stat: -rw-r--r-- 1,676 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// RUN: %clang_cc1 -fsyntax-only -verify %s

typedef struct { int y; } Abstract;

typedef struct { int x; } Alternate;

#define INTERFERE_TYPE Alternate*

@protocol A
@property Abstract *x; // expected-note {{using}}
@end

@interface B
@property Abstract *y; // expected-note {{using}}
@end

@interface B (Category)
@property Abstract *z; // expected-note {{using}}
@end

@interface InterferencePre
-(void) x; // expected-note {{also found}}
-(void) y; // expected-note {{also found}}
-(void) z; // expected-note {{also found}}
-(void) setX: (INTERFERE_TYPE) arg; 
-(void) setY: (INTERFERE_TYPE) arg;
-(void) setZ: (INTERFERE_TYPE) arg;
@end

void f0(id a0) {
  Abstract *l = [a0 x]; // expected-warning {{multiple methods named 'x' found}} 
}

void f1(id a0) {
  Abstract *l = [a0 y]; // expected-warning {{multiple methods named 'y' found}}
}

void f2(id a0) {
  Abstract *l = [a0 z]; // expected-warning {{multiple methods named 'z' found}}
}

void f3(id a0, Abstract *a1) { 
  [ a0 setX: a1];
}

void f4(id a0, Abstract *a1) { 
  [ a0 setY: a1];
}

void f5(id a0, Abstract *a1) { 
  [ a0 setZ: a1];
}

// pr7861
void f6(id<A> a0) {
  Abstract *l = [a0 x];
}

struct test3a { int x, y; };
struct test3b { unsigned x, y; };
@interface Test3A - (struct test3a) test3; @end
@interface Test3B - (struct test3b) test3; @end
void test3(id x) {
  (void) [x test3];
}

struct test4a { int x, y; };
struct test4b { float x, y; };
@interface Test4A - (struct test4a) test4; @end //expected-note{{using}}
@interface Test4B - (struct test4b) test4; @end //expected-note{{also found}}
void test4(id x) {
  (void) [x test4]; //expected-warning {{multiple methods named 'test4' found}}
}