[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / ExtractAPI / objc_id_protocol.m
blob02f4cde772d4878a72462c1d0096c74cf1656fbc
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 MyProtocol
18 @end
20 @interface MyInterface
21 @property(copy, readwrite) id<MyProtocol> obj1;
22 @property(readwrite) id<MyProtocol> *obj2;
23 @end
24 //--- reference.output.json.in
26   "metadata": {
27     "formatVersion": {
28       "major": 0,
29       "minor": 5,
30       "patch": 3
31     },
32     "generator": "?"
33   },
34   "module": {
35     "name": "",
36     "platform": {
37       "architecture": "arm64",
38       "operatingSystem": {
39         "minimumVersion": {
40           "major": 11,
41           "minor": 0,
42           "patch": 0
43         },
44         "name": "macosx"
45       },
46       "vendor": "apple"
47     }
48   },
49   "relationships": [
50     {
51       "kind": "memberOf",
52       "source": "c:objc(cs)MyInterface(py)obj1",
53       "target": "c:objc(cs)MyInterface",
54       "targetFallback": "MyInterface"
55     },
56     {
57       "kind": "memberOf",
58       "source": "c:objc(cs)MyInterface(py)obj2",
59       "target": "c:objc(cs)MyInterface",
60       "targetFallback": "MyInterface"
61     }
62   ],
63   "symbols": [
64     {
65       "accessLevel": "public",
66       "declarationFragments": [
67         {
68           "kind": "keyword",
69           "spelling": "@interface"
70         },
71         {
72           "kind": "text",
73           "spelling": " "
74         },
75         {
76           "kind": "identifier",
77           "spelling": "MyInterface"
78         }
79       ],
80       "identifier": {
81         "interfaceLanguage": "objective-c",
82         "precise": "c:objc(cs)MyInterface"
83       },
84       "kind": {
85         "displayName": "Class",
86         "identifier": "objective-c.class"
87       },
88       "location": {
89         "position": {
90           "character": 12,
91           "line": 4
92         },
93         "uri": "file://INPUT_DIR/input.h"
94       },
95       "names": {
96         "navigator": [
97           {
98             "kind": "identifier",
99             "spelling": "MyInterface"
100           }
101         ],
102         "subHeading": [
103           {
104             "kind": "identifier",
105             "spelling": "MyInterface"
106           }
107         ],
108         "title": "MyInterface"
109       },
110       "pathComponents": [
111         "MyInterface"
112       ]
113     },
114     {
115       "accessLevel": "public",
116       "declarationFragments": [
117         {
118           "kind": "keyword",
119           "spelling": "@property"
120         },
121         {
122           "kind": "text",
123           "spelling": " ("
124         },
125         {
126           "kind": "keyword",
127           "spelling": "copy"
128         },
129         {
130           "kind": "text",
131           "spelling": ", "
132         },
133         {
134           "kind": "keyword",
135           "spelling": "readwrite"
136         },
137         {
138           "kind": "text",
139           "spelling": ") "
140         },
141         {
142           "kind": "typeIdentifier",
143           "preciseIdentifier": "c:Qoobjc(pl)MyProtocol",
144           "spelling": "id<MyProtocol>"
145         },
146         {
147           "kind": "text",
148           "spelling": " "
149         },
150         {
151           "kind": "identifier",
152           "spelling": "obj1"
153         }
154       ],
155       "identifier": {
156         "interfaceLanguage": "objective-c",
157         "precise": "c:objc(cs)MyInterface(py)obj1"
158       },
159       "kind": {
160         "displayName": "Instance Property",
161         "identifier": "objective-c.property"
162       },
163       "location": {
164         "position": {
165           "character": 43,
166           "line": 5
167         },
168         "uri": "file://INPUT_DIR/input.h"
169       },
170       "names": {
171         "navigator": [
172           {
173             "kind": "identifier",
174             "spelling": "obj1"
175           }
176         ],
177         "subHeading": [
178           {
179             "kind": "identifier",
180             "spelling": "obj1"
181           }
182         ],
183         "title": "obj1"
184       },
185       "pathComponents": [
186         "MyInterface",
187         "obj1"
188       ]
189     },
190     {
191       "accessLevel": "public",
192       "declarationFragments": [
193         {
194           "kind": "keyword",
195           "spelling": "@property"
196         },
197         {
198           "kind": "text",
199           "spelling": " ("
200         },
201         {
202           "kind": "keyword",
203           "spelling": "readwrite"
204         },
205         {
206           "kind": "text",
207           "spelling": ") "
208         },
209         {
210           "kind": "typeIdentifier",
211           "preciseIdentifier": "c:Qoobjc(pl)MyProtocol",
212           "spelling": "id<MyProtocol>"
213         },
214         {
215           "kind": "text",
216           "spelling": " * "
217         },
218         {
219           "kind": "identifier",
220           "spelling": "obj2"
221         }
222       ],
223       "identifier": {
224         "interfaceLanguage": "objective-c",
225         "precise": "c:objc(cs)MyInterface(py)obj2"
226       },
227       "kind": {
228         "displayName": "Instance Property",
229         "identifier": "objective-c.property"
230       },
231       "location": {
232         "position": {
233           "character": 38,
234           "line": 6
235         },
236         "uri": "file://INPUT_DIR/input.h"
237       },
238       "names": {
239         "navigator": [
240           {
241             "kind": "identifier",
242             "spelling": "obj2"
243           }
244         ],
245         "subHeading": [
246           {
247             "kind": "identifier",
248             "spelling": "obj2"
249           }
250         ],
251         "title": "obj2"
252       },
253       "pathComponents": [
254         "MyInterface",
255         "obj2"
256       ]
257     },
258     {
259       "accessLevel": "public",
260       "declarationFragments": [
261         {
262           "kind": "keyword",
263           "spelling": "@protocol"
264         },
265         {
266           "kind": "text",
267           "spelling": " "
268         },
269         {
270           "kind": "identifier",
271           "spelling": "MyProtocol"
272         }
273       ],
274       "identifier": {
275         "interfaceLanguage": "objective-c",
276         "precise": "c:objc(pl)MyProtocol"
277       },
278       "kind": {
279         "displayName": "Protocol",
280         "identifier": "objective-c.protocol"
281       },
282       "location": {
283         "position": {
284           "character": 11,
285           "line": 1
286         },
287         "uri": "file://INPUT_DIR/input.h"
288       },
289       "names": {
290         "navigator": [
291           {
292             "kind": "identifier",
293             "spelling": "MyProtocol"
294           }
295         ],
296         "subHeading": [
297           {
298             "kind": "identifier",
299             "spelling": "MyProtocol"
300           }
301         ],
302         "title": "MyProtocol"
303       },
304       "pathComponents": [
305         "MyProtocol"
306       ]
307     }
308   ]