[AMDGPU] Removed superfluous predicate. NFC.
[llvm-project.git] / clang / test / ExtractAPI / objc_interface.m
blob02663a790683a2ff4cd5770af986da82ba2894a5
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           "kind": "text",
585           "spelling": ";"
586         }
587       ],
588       "identifier": {
589         "interfaceLanguage": "objective-c",
590         "precise": "c:objc(cs)Derived@Ivar"
591       },
592       "kind": {
593         "displayName": "Instance Variable",
594         "identifier": "objective-c.ivar"
595       },
596       "location": {
597         "position": {
598           "character": 8,
599           "line": 10
600         },
601         "uri": "file://INPUT_DIR/input.h"
602       },
603       "names": {
604         "navigator": [
605           {
606             "kind": "identifier",
607             "spelling": "Ivar"
608           }
609         ],
610         "subHeading": [
611           {
612             "kind": "identifier",
613             "spelling": "Ivar"
614           }
615         ],
616         "title": "Ivar"
617       },
618       "pathComponents": [
619         "Derived",
620         "Ivar"
621       ]
622     },
623     {
624       "accessLevel": "public",
625       "declarationFragments": [
626         {
627           "kind": "text",
628           "spelling": "- ("
629         },
630         {
631           "kind": "typeIdentifier",
632           "preciseIdentifier": "c:C",
633           "spelling": "char"
634         },
635         {
636           "kind": "text",
637           "spelling": ") "
638         },
639         {
640           "kind": "identifier",
641           "spelling": "getIvar"
642         },
643         {
644           "kind": "text",
645           "spelling": ";"
646         }
647       ],
648       "functionSignature": {
649         "returns": [
650           {
651             "kind": "typeIdentifier",
652             "preciseIdentifier": "c:C",
653             "spelling": "char"
654           }
655         ]
656       },
657       "identifier": {
658         "interfaceLanguage": "objective-c",
659         "precise": "c:objc(cs)Derived(im)getIvar"
660       },
661       "kind": {
662         "displayName": "Instance Method",
663         "identifier": "objective-c.method"
664       },
665       "location": {
666         "position": {
667           "character": 1,
668           "line": 12
669         },
670         "uri": "file://INPUT_DIR/input.h"
671       },
672       "names": {
673         "navigator": [
674           {
675             "kind": "identifier",
676             "spelling": "getIvar"
677           }
678         ],
679         "subHeading": [
680           {
681             "kind": "text",
682             "spelling": "- "
683           },
684           {
685             "kind": "identifier",
686             "spelling": "getIvar"
687           }
688         ],
689         "title": "getIvar"
690       },
691       "pathComponents": [
692         "Derived",
693         "getIvar"
694       ]
695     }
696   ]