[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / ExtractAPI / methods.cpp
blobf25f9ecf0605c006f8f22f800d53ee77a7bf2acb
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_cc1 -extract-api -triple arm64-apple-macosx \
6 // RUN: -x c++-header %t/input.h -o %t/output.json -verify
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 //--- input.h
14 class Foo {
15 int getCount();
17 void setLength(int length) noexcept;
19 public:
20 static double getFoo();
22 protected:
23 constexpr int getBar() const;
25 /// expected-no-diagnostics
27 //--- reference.output.json.in
29 "metadata": {
30 "formatVersion": {
31 "major": 0,
32 "minor": 5,
33 "patch": 3
35 "generator": "?"
37 "module": {
38 "name": "",
39 "platform": {
40 "architecture": "arm64",
41 "operatingSystem": {
42 "minimumVersion": {
43 "major": 11,
44 "minor": 0,
45 "patch": 0
47 "name": "macosx"
49 "vendor": "apple"
52 "relationships": [
54 "kind": "memberOf",
55 "source": "c:@S@Foo@F@getCount#",
56 "target": "c:@S@Foo",
57 "targetFallback": "Foo"
60 "kind": "memberOf",
61 "source": "c:@S@Foo@F@setLength#I#",
62 "target": "c:@S@Foo",
63 "targetFallback": "Foo"
66 "kind": "memberOf",
67 "source": "c:@S@Foo@F@getBar#1",
68 "target": "c:@S@Foo",
69 "targetFallback": "Foo"
72 "kind": "memberOf",
73 "source": "c:@S@Foo@F@getFoo#S",
74 "target": "c:@S@Foo",
75 "targetFallback": "Foo"
78 "symbols": [
80 "accessLevel": "public",
81 "declarationFragments": [
83 "kind": "keyword",
84 "spelling": "class"
87 "kind": "text",
88 "spelling": " "
91 "kind": "identifier",
92 "spelling": "Foo"
95 "kind": "text",
96 "spelling": ";"
99 "identifier": {
100 "interfaceLanguage": "c++",
101 "precise": "c:@S@Foo"
103 "kind": {
104 "displayName": "Class",
105 "identifier": "c++.class"
107 "location": {
108 "position": {
109 "character": 7,
110 "line": 1
112 "uri": "file://INPUT_DIR/input.h"
114 "names": {
115 "navigator": [
117 "kind": "identifier",
118 "spelling": "Foo"
121 "subHeading": [
123 "kind": "identifier",
124 "spelling": "Foo"
127 "title": "Foo"
129 "pathComponents": [
130 "Foo"
134 "accessLevel": "private",
135 "declarationFragments": [
137 "kind": "typeIdentifier",
138 "preciseIdentifier": "c:I",
139 "spelling": "int"
142 "kind": "text",
143 "spelling": " "
146 "kind": "identifier",
147 "spelling": "getCount"
150 "kind": "text",
151 "spelling": "();"
154 "functionSignature": {
155 "returns": [
157 "kind": "typeIdentifier",
158 "preciseIdentifier": "c:I",
159 "spelling": "int"
163 "identifier": {
164 "interfaceLanguage": "c++",
165 "precise": "c:@S@Foo@F@getCount#"
167 "kind": {
168 "displayName": "Instance Method",
169 "identifier": "c++.method"
171 "location": {
172 "position": {
173 "character": 7,
174 "line": 2
176 "uri": "file://INPUT_DIR/input.h"
178 "names": {
179 "navigator": [
181 "kind": "identifier",
182 "spelling": "getCount"
185 "subHeading": [
187 "kind": "identifier",
188 "spelling": "getCount"
191 "title": "getCount"
193 "pathComponents": [
194 "Foo",
195 "getCount"
199 "accessLevel": "private",
200 "declarationFragments": [
202 "kind": "typeIdentifier",
203 "preciseIdentifier": "c:v",
204 "spelling": "void"
207 "kind": "text",
208 "spelling": " "
211 "kind": "identifier",
212 "spelling": "setLength"
215 "kind": "text",
216 "spelling": "("
219 "kind": "typeIdentifier",
220 "preciseIdentifier": "c:I",
221 "spelling": "int"
224 "kind": "text",
225 "spelling": " "
228 "kind": "internalParam",
229 "spelling": "length"
232 "kind": "text",
233 "spelling": ")"
236 "kind": "text",
237 "spelling": " "
240 "kind": "keyword",
241 "spelling": "noexcept"
244 "kind": "text",
245 "spelling": ";"
248 "functionSignature": {
249 "parameters": [
251 "declarationFragments": [
253 "kind": "typeIdentifier",
254 "preciseIdentifier": "c:I",
255 "spelling": "int"
258 "kind": "text",
259 "spelling": " "
262 "kind": "internalParam",
263 "spelling": "length"
266 "name": "length"
269 "returns": [
271 "kind": "typeIdentifier",
272 "preciseIdentifier": "c:v",
273 "spelling": "void"
277 "identifier": {
278 "interfaceLanguage": "c++",
279 "precise": "c:@S@Foo@F@setLength#I#"
281 "kind": {
282 "displayName": "Instance Method",
283 "identifier": "c++.method"
285 "location": {
286 "position": {
287 "character": 8,
288 "line": 4
290 "uri": "file://INPUT_DIR/input.h"
292 "names": {
293 "navigator": [
295 "kind": "identifier",
296 "spelling": "setLength"
299 "subHeading": [
301 "kind": "identifier",
302 "spelling": "setLength"
305 "title": "setLength"
307 "pathComponents": [
308 "Foo",
309 "setLength"
313 "accessLevel": "protected",
314 "declarationFragments": [
316 "kind": "keyword",
317 "spelling": "constexpr"
320 "kind": "text",
321 "spelling": " "
324 "kind": "typeIdentifier",
325 "preciseIdentifier": "c:I",
326 "spelling": "int"
329 "kind": "text",
330 "spelling": " "
333 "kind": "identifier",
334 "spelling": "getBar"
337 "kind": "text",
338 "spelling": "() "
341 "kind": "keyword",
342 "spelling": "const"
345 "kind": "text",
346 "spelling": ";"
349 "functionSignature": {
350 "returns": [
352 "kind": "typeIdentifier",
353 "preciseIdentifier": "c:I",
354 "spelling": "int"
358 "identifier": {
359 "interfaceLanguage": "c++",
360 "precise": "c:@S@Foo@F@getBar#1"
362 "kind": {
363 "displayName": "Instance Method",
364 "identifier": "c++.method"
366 "location": {
367 "position": {
368 "character": 17,
369 "line": 10
371 "uri": "file://INPUT_DIR/input.h"
373 "names": {
374 "navigator": [
376 "kind": "identifier",
377 "spelling": "getBar"
380 "subHeading": [
382 "kind": "identifier",
383 "spelling": "getBar"
386 "title": "getBar"
388 "pathComponents": [
389 "Foo",
390 "getBar"
394 "accessLevel": "public",
395 "declarationFragments": [
397 "kind": "keyword",
398 "spelling": "static"
401 "kind": "text",
402 "spelling": " "
405 "kind": "typeIdentifier",
406 "preciseIdentifier": "c:d",
407 "spelling": "double"
410 "kind": "text",
411 "spelling": " "
414 "kind": "identifier",
415 "spelling": "getFoo"
418 "kind": "text",
419 "spelling": "();"
422 "functionSignature": {
423 "returns": [
425 "kind": "typeIdentifier",
426 "preciseIdentifier": "c:d",
427 "spelling": "double"
431 "identifier": {
432 "interfaceLanguage": "c++",
433 "precise": "c:@S@Foo@F@getFoo#S"
435 "kind": {
436 "displayName": "Static Method",
437 "identifier": "c++.type.method"
439 "location": {
440 "position": {
441 "character": 17,
442 "line": 7
444 "uri": "file://INPUT_DIR/input.h"
446 "names": {
447 "navigator": [
449 "kind": "identifier",
450 "spelling": "getFoo"
453 "subHeading": [
455 "kind": "identifier",
456 "spelling": "getFoo"
459 "title": "getFoo"
461 "pathComponents": [
462 "Foo",
463 "getFoo"