[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / clang / test / SemaObjC / super.m
blobfd069af7b02c9606e6fa8475a43e2cc843dd11f2
1 // RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
3 void takevoidptr(void*);
6 @interface Foo
7 - iMethod;
8 + cMethod;
9 @end
11 @interface A
12 + superClassMethod;
13 - (void)instanceMethod;
14 @end
16 @interface B : A
17 - (void)instanceMethod;
18 + classMethod;
19 @end
21 @implementation B
23 - (void)instanceMethod {
24   [super iMethod]; // expected-warning{{'A' may not respond to 'iMethod'}}
25   
26   // Use of super in a block is ok and does codegen to the right thing.
27   // rdar://7852959
28   takevoidptr(^{
29     [super instanceMethod];
30   });
33 + classMethod {
34   [super cMethod]; // expected-warning{{method '+cMethod' not found (return type defaults to 'id')}}
35   
36   id X[] = { [ super superClassMethod] };
37   id Y[] = {
38     [ super.superClassMethod iMethod],
39     super.superClassMethod,
40     (id)super.superClassMethod  // not a cast of super: rdar://7853261
41   };
42   return 0;
44 @end
46 @interface XX
47 - m;
48 @end
50 void f(id super) {
51   [super m];
53 void f0(int super) {
54   [super m]; // expected-warning{{receiver type 'int' is not 'id'}}
56 void f1(id puper) {  // expected-note {{'puper' declared here}}
57   [super m]; // expected-error{{use of undeclared identifier 'super'}}
60 // radar 7400691
61 typedef Foo super;
63 typedef Foo FooTD;
65 void test() {
66   [FooTD cMethod];
67   [super cMethod];
70 struct SomeStruct {
71   int X;
74 int test2() {
75   struct SomeStruct super = { 0 };
76   return super.X;
79 int test3() {
80   id super = 0;
81   [(B*)super instanceMethod];
82   int *s1 = (int*)super;
83   
84   id X[] = { [ super superClassMethod] };
85   return 0;