[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / ExtractAPI / method_template_spec.cpp
blobc3ba262d41f9a13cf22b914678bcaf3e8baf5136
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 template<typename T> void Bar(T Fizz);
17 template<> void Bar<int>(int Fizz);
20 /// expected-no-diagnostics
22 //--- reference.output.json.in
24 "metadata": {
25 "formatVersion": {
26 "major": 0,
27 "minor": 5,
28 "patch": 3
30 "generator": "?"
32 "module": {
33 "name": "",
34 "platform": {
35 "architecture": "arm64",
36 "operatingSystem": {
37 "minimumVersion": {
38 "major": 11,
39 "minor": 0,
40 "patch": 0
42 "name": "macosx"
44 "vendor": "apple"
47 "relationships": [
49 "kind": "memberOf",
50 "source": "c:@S@Foo@FT@>1#TBar#t0.0#v#",
51 "target": "c:@S@Foo",
52 "targetFallback": "Foo"
55 "kind": "memberOf",
56 "source": "c:@S@Foo@F@Bar<#I>#I#",
57 "target": "c:@S@Foo",
58 "targetFallback": "Foo"
61 "symbols": [
63 "accessLevel": "public",
64 "declarationFragments": [
66 "kind": "keyword",
67 "spelling": "class"
70 "kind": "text",
71 "spelling": " "
74 "kind": "identifier",
75 "spelling": "Foo"
78 "kind": "text",
79 "spelling": ";"
82 "identifier": {
83 "interfaceLanguage": "c++",
84 "precise": "c:@S@Foo"
86 "kind": {
87 "displayName": "Class",
88 "identifier": "c++.class"
90 "location": {
91 "position": {
92 "character": 7,
93 "line": 1
95 "uri": "file://INPUT_DIR/input.h"
97 "names": {
98 "navigator": [
100 "kind": "identifier",
101 "spelling": "Foo"
104 "subHeading": [
106 "kind": "identifier",
107 "spelling": "Foo"
110 "title": "Foo"
112 "pathComponents": [
113 "Foo"
117 "accessLevel": "private",
118 "declarationFragments": [
120 "kind": "keyword",
121 "spelling": "template"
124 "kind": "text",
125 "spelling": "<"
128 "kind": "keyword",
129 "spelling": "typename"
132 "kind": "text",
133 "spelling": " "
136 "kind": "genericParameter",
137 "spelling": "T"
140 "kind": "text",
141 "spelling": "> "
144 "kind": "typeIdentifier",
145 "preciseIdentifier": "c:v",
146 "spelling": "void"
149 "kind": "text",
150 "spelling": " "
153 "kind": "identifier",
154 "spelling": "Bar"
157 "kind": "text",
158 "spelling": "("
161 "kind": "typeIdentifier",
162 "preciseIdentifier": "c:t0.0",
163 "spelling": "T"
166 "kind": "text",
167 "spelling": " "
170 "kind": "internalParam",
171 "spelling": "Fizz"
174 "kind": "text",
175 "spelling": ");"
178 "functionSignature": {
179 "parameters": [
181 "declarationFragments": [
183 "kind": "typeIdentifier",
184 "preciseIdentifier": "c:t0.0",
185 "spelling": "T"
188 "kind": "text",
189 "spelling": " "
192 "kind": "internalParam",
193 "spelling": "Fizz"
196 "name": "Fizz"
199 "returns": [
201 "kind": "typeIdentifier",
202 "preciseIdentifier": "c:v",
203 "spelling": "void"
207 "identifier": {
208 "interfaceLanguage": "c++",
209 "precise": "c:@S@Foo@FT@>1#TBar#t0.0#v#"
211 "kind": {
212 "displayName": "Method Template",
213 "identifier": "c++.method"
215 "location": {
216 "position": {
217 "character": 29,
218 "line": 2
220 "uri": "file://INPUT_DIR/input.h"
222 "names": {
223 "navigator": [
225 "kind": "identifier",
226 "spelling": "Bar"
229 "subHeading": [
231 "kind": "identifier",
232 "spelling": "Bar"
235 "title": "Bar"
237 "pathComponents": [
238 "Foo",
239 "Bar"
241 "swiftGenerics": {
242 "parameters": [
244 "depth": 0,
245 "index": 0,
246 "name": "T"
252 "accessLevel": "private",
253 "declarationFragments": [
255 "kind": "keyword",
256 "spelling": "template"
259 "kind": "text",
260 "spelling": "<> "
263 "kind": "typeIdentifier",
264 "preciseIdentifier": "c:v",
265 "spelling": "void"
268 "kind": "text",
269 "spelling": " "
272 "kind": "identifier",
273 "spelling": "Bar"
276 "kind": "text",
277 "spelling": "<"
280 "kind": "typeIdentifier",
281 "preciseIdentifier": "c:I",
282 "spelling": "int"
285 "kind": "text",
286 "spelling": ">("
289 "kind": "typeIdentifier",
290 "preciseIdentifier": "c:I",
291 "spelling": "int"
294 "kind": "text",
295 "spelling": " "
298 "kind": "internalParam",
299 "spelling": "Fizz"
302 "kind": "text",
303 "spelling": ");"
306 "functionSignature": {
307 "parameters": [
309 "declarationFragments": [
311 "kind": "typeIdentifier",
312 "preciseIdentifier": "c:I",
313 "spelling": "int"
316 "kind": "text",
317 "spelling": " "
320 "kind": "internalParam",
321 "spelling": "Fizz"
324 "name": "Fizz"
327 "returns": [
329 "kind": "typeIdentifier",
330 "preciseIdentifier": "c:v",
331 "spelling": "void"
335 "identifier": {
336 "interfaceLanguage": "c++",
337 "precise": "c:@S@Foo@F@Bar<#I>#I#"
339 "kind": {
340 "displayName": "Method Template Specialization",
341 "identifier": "c++.method"
343 "location": {
344 "position": {
345 "character": 19,
346 "line": 4
348 "uri": "file://INPUT_DIR/input.h"
350 "names": {
351 "navigator": [
353 "kind": "identifier",
354 "spelling": "Bar"
357 "subHeading": [
359 "kind": "identifier",
360 "spelling": "Bar"
363 "title": "Bar"
365 "pathComponents": [
366 "Foo",
367 "Bar"