[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / ExtractAPI / objc_interface.m
blob3f53546866513c69e1d31af36564c89a2d038451
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
4 // RUN: %t/reference.output.json.in >> %t/reference.output.json
5 // RUN: %clang -extract-api -x objective-c-header -target arm64-apple-macosx \
6 // RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
8 // Generator version is not consistent across test runs, normalize it.
9 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
10 // RUN: %t/output.json >> %t/output-normalized.json
11 // RUN: diff %t/reference.output.json %t/output-normalized.json
13 // CHECK-NOT: error:
14 // CHECK-NOT: warning:
16 //--- input.h
17 @protocol Protocol;
19 @interface Super <Protocol>
20 @property(readonly, getter=getProperty) unsigned Property;
21 + (id)getWithProperty:(unsigned) Property;
22 - (void)setProperty:(unsigned) Property andOtherThing: (unsigned) Thing;
23 @end
25 @interface Derived : Super {
26   char Ivar;
28 - (char)getIvar;
29 @end
31 //--- reference.output.json.in
33   "metadata": {
34     "formatVersion": {
35       "major": 0,
36       "minor": 5,
37       "patch": 3
38     },
39     "generator": "?"
40   },
41   "module": {
42     "name": "",
43     "platform": {
44       "architecture": "arm64",
45       "operatingSystem": {
46         "minimumVersion": {
47           "major": 11,
48           "minor": 0,
49           "patch": 0
50         },
51         "name": "macosx"
52       },
53       "vendor": "apple"
54     }
55   },
56   "relationships": [
57     {
58       "kind": "memberOf",
59       "source": "c:objc(cs)Super(cm)getWithProperty:",
60       "target": "c:objc(cs)Super",
61       "targetFallback": "Super"
62     },
63     {
64       "kind": "memberOf",
65       "source": "c:objc(cs)Super(im)setProperty:andOtherThing:",
66       "target": "c:objc(cs)Super",
67       "targetFallback": "Super"
68     },
69     {
70       "kind": "memberOf",
71       "source": "c:objc(cs)Super(py)Property",
72       "target": "c:objc(cs)Super",
73       "targetFallback": "Super"
74     },
75     {
76       "kind": "conformsTo",
77       "source": "c:objc(cs)Super",
78       "target": "c:objc(pl)Protocol",
79       "targetFallback": "Protocol"
80     },
81     {
82       "kind": "memberOf",
83       "source": "c:objc(cs)Derived@Ivar",
84       "target": "c:objc(cs)Derived",
85       "targetFallback": "Derived"
86     },
87     {
88       "kind": "memberOf",
89       "source": "c:objc(cs)Derived(im)getIvar",
90       "target": "c:objc(cs)Derived",
91       "targetFallback": "Derived"
92     },
93     {
94       "kind": "inheritsFrom",
95       "source": "c:objc(cs)Derived",
96       "target": "c:objc(cs)Super",
97       "targetFallback": "Super"
98     }
99   ],
100   "symbols": [
101     {
102       "accessLevel": "public",
103       "declarationFragments": [
104         {
105           "kind": "keyword",
106           "spelling": "@interface"
107         },
108         {
109           "kind": "text",
110           "spelling": " "
111         },
112         {
113           "kind": "identifier",
114           "spelling": "Super"
115         }
116       ],
117       "identifier": {
118         "interfaceLanguage": "objective-c",
119         "precise": "c:objc(cs)Super"
120       },
121       "kind": {
122         "displayName": "Class",
123         "identifier": "objective-c.class"
124       },
125       "location": {
126         "position": {
127           "character": 12,
128           "line": 3
129         },
130         "uri": "file://INPUT_DIR/input.h"
131       },
132       "names": {
133         "navigator": [
134           {
135             "kind": "identifier",
136             "spelling": "Super"
137           }
138         ],
139         "subHeading": [
140           {
141             "kind": "identifier",
142             "spelling": "Super"
143           }
144         ],
145         "title": "Super"
146       },
147       "pathComponents": [
148         "Super"
149       ]
150     },
151     {
152       "accessLevel": "public",
153       "declarationFragments": [
154         {
155           "kind": "text",
156           "spelling": "+ ("
157         },
158         {
159           "kind": "keyword",
160           "spelling": "id"
161         },
162         {
163           "kind": "text",
164           "spelling": ") "
165         },
166         {
167           "kind": "identifier",
168           "spelling": "getWithProperty:"
169         },
170         {
171           "kind": "text",
172           "spelling": "("
173         },
174         {
175           "kind": "typeIdentifier",
176           "preciseIdentifier": "c:i",
177           "spelling": "unsigned int"
178         },
179         {
180           "kind": "text",
181           "spelling": ") "
182         },
183         {
184           "kind": "internalParam",
185           "spelling": "Property"
186         },
187         {
188           "kind": "text",
189           "spelling": ";"
190         }
191       ],
192       "functionSignature": {
193         "parameters": [
194           {
195             "declarationFragments": [
196               {
197                 "kind": "text",
198                 "spelling": "("
199               },
200               {
201                 "kind": "typeIdentifier",
202                 "preciseIdentifier": "c:i",
203                 "spelling": "unsigned int"
204               },
205               {
206                 "kind": "text",
207                 "spelling": ") "
208               },
209               {
210                 "kind": "internalParam",
211                 "spelling": "Property"
212               }
213             ],
214             "name": "Property"
215           }
216         ],
217         "returns": [
218           {
219             "kind": "keyword",
220             "spelling": "id"
221           }
222         ]
223       },
224       "identifier": {
225         "interfaceLanguage": "objective-c",
226         "precise": "c:objc(cs)Super(cm)getWithProperty:"
227       },
228       "kind": {
229         "displayName": "Type Method",
230         "identifier": "objective-c.type.method"
231       },
232       "location": {
233         "position": {
234           "character": 1,
235           "line": 5
236         },
237         "uri": "file://INPUT_DIR/input.h"
238       },
239       "names": {
240         "navigator": [
241           {
242             "kind": "identifier",
243             "spelling": "getWithProperty:"
244           }
245         ],
246         "subHeading": [
247           {
248             "kind": "text",
249             "spelling": "+ "
250           },
251           {
252             "kind": "identifier",
253             "spelling": "getWithProperty:"
254           }
255         ],
256         "title": "getWithProperty:"
257       },
258       "pathComponents": [
259         "Super",
260         "getWithProperty:"
261       ]
262     },
263     {
264       "accessLevel": "public",
265       "declarationFragments": [
266         {
267           "kind": "text",
268           "spelling": "- ("
269         },
270         {
271           "kind": "typeIdentifier",
272           "preciseIdentifier": "c:v",
273           "spelling": "void"
274         },
275         {
276           "kind": "text",
277           "spelling": ") "
278         },
279         {
280           "kind": "identifier",
281           "spelling": "setProperty:"
282         },
283         {
284           "kind": "text",
285           "spelling": "("
286         },
287         {
288           "kind": "typeIdentifier",
289           "preciseIdentifier": "c:i",
290           "spelling": "unsigned int"
291         },
292         {
293           "kind": "text",
294           "spelling": ") "
295         },
296         {
297           "kind": "internalParam",
298           "spelling": "Property"
299         },
300         {
301           "kind": "text",
302           "spelling": " "
303         },
304         {
305           "kind": "identifier",
306           "spelling": "andOtherThing:"
307         },
308         {
309           "kind": "text",
310           "spelling": "("
311         },
312         {
313           "kind": "typeIdentifier",
314           "preciseIdentifier": "c:i",
315           "spelling": "unsigned int"
316         },
317         {
318           "kind": "text",
319           "spelling": ") "
320         },
321         {
322           "kind": "internalParam",
323           "spelling": "Thing"
324         },
325         {
326           "kind": "text",
327           "spelling": ";"
328         }
329       ],
330       "functionSignature": {
331         "parameters": [
332           {
333             "declarationFragments": [
334               {
335                 "kind": "text",
336                 "spelling": "("
337               },
338               {
339                 "kind": "typeIdentifier",
340                 "preciseIdentifier": "c:i",
341                 "spelling": "unsigned int"
342               },
343               {
344                 "kind": "text",
345                 "spelling": ") "
346               },
347               {
348                 "kind": "internalParam",
349                 "spelling": "Property"
350               }
351             ],
352             "name": "Property"
353           },
354           {
355             "declarationFragments": [
356               {
357                 "kind": "text",
358                 "spelling": "("
359               },
360               {
361                 "kind": "typeIdentifier",
362                 "preciseIdentifier": "c:i",
363                 "spelling": "unsigned int"
364               },
365               {
366                 "kind": "text",
367                 "spelling": ") "
368               },
369               {
370                 "kind": "internalParam",
371                 "spelling": "Thing"
372               }
373             ],
374             "name": "Thing"
375           }
376         ],
377         "returns": [
378           {
379             "kind": "typeIdentifier",
380             "preciseIdentifier": "c:v",
381             "spelling": "void"
382           }
383         ]
384       },
385       "identifier": {
386         "interfaceLanguage": "objective-c",
387         "precise": "c:objc(cs)Super(im)setProperty:andOtherThing:"
388       },
389       "kind": {
390         "displayName": "Instance Method",
391         "identifier": "objective-c.method"
392       },
393       "location": {
394         "position": {
395           "character": 1,
396           "line": 6
397         },
398         "uri": "file://INPUT_DIR/input.h"
399       },
400       "names": {
401         "navigator": [
402           {
403             "kind": "identifier",
404             "spelling": "setProperty:andOtherThing:"
405           }
406         ],
407         "subHeading": [
408           {
409             "kind": "text",
410             "spelling": "- "
411           },
412           {
413             "kind": "identifier",
414             "spelling": "setProperty:andOtherThing:"
415           }
416         ],
417         "title": "setProperty:andOtherThing:"
418       },
419       "pathComponents": [
420         "Super",
421         "setProperty:andOtherThing:"
422       ]
423     },
424     {
425       "accessLevel": "public",
426       "declarationFragments": [
427         {
428           "kind": "keyword",
429           "spelling": "@property"
430         },
431         {
432           "kind": "text",
433           "spelling": " ("
434         },
435         {
436           "kind": "keyword",
437           "spelling": "readonly"
438         },
439         {
440           "kind": "text",
441           "spelling": ", "
442         },
443         {
444           "kind": "keyword",
445           "spelling": "getter"
446         },
447         {
448           "kind": "text",
449           "spelling": "="
450         },
451         {
452           "kind": "identifier",
453           "spelling": "getProperty"
454         },
455         {
456           "kind": "text",
457           "spelling": ") "
458         },
459         {
460           "kind": "typeIdentifier",
461           "preciseIdentifier": "c:i",
462           "spelling": "unsigned int"
463         },
464         {
465           "kind": "text",
466           "spelling": " "
467         },
468         {
469           "kind": "identifier",
470           "spelling": "Property"
471         }
472       ],
473       "identifier": {
474         "interfaceLanguage": "objective-c",
475         "precise": "c:objc(cs)Super(py)Property"
476       },
477       "kind": {
478         "displayName": "Instance Property",
479         "identifier": "objective-c.property"
480       },
481       "location": {
482         "position": {
483           "character": 50,
484           "line": 4
485         },
486         "uri": "file://INPUT_DIR/input.h"
487       },
488       "names": {
489         "navigator": [
490           {
491             "kind": "identifier",
492             "spelling": "Property"
493           }
494         ],
495         "subHeading": [
496           {
497             "kind": "identifier",
498             "spelling": "Property"
499           }
500         ],
501         "title": "Property"
502       },
503       "pathComponents": [
504         "Super",
505         "Property"
506       ]
507     },
508     {
509       "accessLevel": "public",
510       "declarationFragments": [
511         {
512           "kind": "keyword",
513           "spelling": "@interface"
514         },
515         {
516           "kind": "text",
517           "spelling": " "
518         },
519         {
520           "kind": "identifier",
521           "spelling": "Derived"
522         },
523         {
524           "kind": "text",
525           "spelling": " : "
526         },
527         {
528           "kind": "typeIdentifier",
529           "preciseIdentifier": "c:objc(cs)Super",
530           "spelling": "Super"
531         }
532       ],
533       "identifier": {
534         "interfaceLanguage": "objective-c",
535         "precise": "c:objc(cs)Derived"
536       },
537       "kind": {
538         "displayName": "Class",
539         "identifier": "objective-c.class"
540       },
541       "location": {
542         "position": {
543           "character": 12,
544           "line": 9
545         },
546         "uri": "file://INPUT_DIR/input.h"
547       },
548       "names": {
549         "navigator": [
550           {
551             "kind": "identifier",
552             "spelling": "Derived"
553           }
554         ],
555         "subHeading": [
556           {
557             "kind": "identifier",
558             "spelling": "Derived"
559           }
560         ],
561         "title": "Derived"
562       },
563       "pathComponents": [
564         "Derived"
565       ]
566     },
567     {
568       "accessLevel": "public",
569       "declarationFragments": [
570         {
571           "kind": "typeIdentifier",
572           "preciseIdentifier": "c:C",
573           "spelling": "char"
574         },
575         {
576           "kind": "text",
577           "spelling": " "
578         },
579         {
580           "kind": "identifier",
581           "spelling": "Ivar"
582         }
583       ],
584       "identifier": {
585         "interfaceLanguage": "objective-c",
586         "precise": "c:objc(cs)Derived@Ivar"
587       },
588       "kind": {
589         "displayName": "Instance Variable",
590         "identifier": "objective-c.ivar"
591       },
592       "location": {
593         "position": {
594           "character": 8,
595           "line": 10
596         },
597         "uri": "file://INPUT_DIR/input.h"
598       },
599       "names": {
600         "navigator": [
601           {
602             "kind": "identifier",
603             "spelling": "Ivar"
604           }
605         ],
606         "subHeading": [
607           {
608             "kind": "identifier",
609             "spelling": "Ivar"
610           }
611         ],
612         "title": "Ivar"
613       },
614       "pathComponents": [
615         "Derived",
616         "Ivar"
617       ]
618     },
619     {
620       "accessLevel": "public",
621       "declarationFragments": [
622         {
623           "kind": "text",
624           "spelling": "- ("
625         },
626         {
627           "kind": "typeIdentifier",
628           "preciseIdentifier": "c:C",
629           "spelling": "char"
630         },
631         {
632           "kind": "text",
633           "spelling": ") "
634         },
635         {
636           "kind": "identifier",
637           "spelling": "getIvar"
638         },
639         {
640           "kind": "text",
641           "spelling": ";"
642         }
643       ],
644       "functionSignature": {
645         "returns": [
646           {
647             "kind": "typeIdentifier",
648             "preciseIdentifier": "c:C",
649             "spelling": "char"
650           }
651         ]
652       },
653       "identifier": {
654         "interfaceLanguage": "objective-c",
655         "precise": "c:objc(cs)Derived(im)getIvar"
656       },
657       "kind": {
658         "displayName": "Instance Method",
659         "identifier": "objective-c.method"
660       },
661       "location": {
662         "position": {
663           "character": 1,
664           "line": 12
665         },
666         "uri": "file://INPUT_DIR/input.h"
667       },
668       "names": {
669         "navigator": [
670           {
671             "kind": "identifier",
672             "spelling": "getIvar"
673           }
674         ],
675         "subHeading": [
676           {
677             "kind": "text",
678             "spelling": "- "
679           },
680           {
681             "kind": "identifier",
682             "spelling": "getIvar"
683           }
684         ],
685         "title": "getIvar"
686       },
687       "pathComponents": [
688         "Derived",
689         "getIvar"
690       ]
691     }
692   ]