llvm-project
206 строк · 4.2 Кб
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 --pretty-sgf -triple arm64-apple-macosx \
6// RUN: -x c++-header %t/input.h -o %t/output.json -verify
7
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
12
13//--- input.h
14class Foo {
15template<typename T> static T Bar;
16};
17
18/// expected-no-diagnostics
19
20//--- reference.output.json.in
21{
22"metadata": {
23"formatVersion": {
24"major": 0,
25"minor": 5,
26"patch": 3
27},
28"generator": "?"
29},
30"module": {
31"name": "",
32"platform": {
33"architecture": "arm64",
34"operatingSystem": {
35"minimumVersion": {
36"major": 11,
37"minor": 0,
38"patch": 0
39},
40"name": "macosx"
41},
42"vendor": "apple"
43}
44},
45"relationships": [
46{
47"kind": "memberOf",
48"source": "c:@S@Foo@Bar",
49"target": "c:@S@Foo",
50"targetFallback": "Foo"
51}
52],
53"symbols": [
54{
55"accessLevel": "public",
56"declarationFragments": [
57{
58"kind": "keyword",
59"spelling": "class"
60},
61{
62"kind": "text",
63"spelling": " "
64},
65{
66"kind": "identifier",
67"spelling": "Foo"
68},
69{
70"kind": "text",
71"spelling": ";"
72}
73],
74"identifier": {
75"interfaceLanguage": "c++",
76"precise": "c:@S@Foo"
77},
78"kind": {
79"displayName": "Class",
80"identifier": "c++.class"
81},
82"location": {
83"position": {
84"character": 6,
85"line": 0
86},
87"uri": "file://INPUT_DIR/input.h"
88},
89"names": {
90"navigator": [
91{
92"kind": "identifier",
93"spelling": "Foo"
94}
95],
96"subHeading": [
97{
98"kind": "identifier",
99"spelling": "Foo"
100}
101],
102"title": "Foo"
103},
104"pathComponents": [
105"Foo"
106]
107},
108{
109"accessLevel": "private",
110"declarationFragments": [
111{
112"kind": "keyword",
113"spelling": "template"
114},
115{
116"kind": "text",
117"spelling": " <"
118},
119{
120"kind": "keyword",
121"spelling": "typename"
122},
123{
124"kind": "text",
125"spelling": " "
126},
127{
128"kind": "genericParameter",
129"spelling": "T"
130},
131{
132"kind": "text",
133"spelling": "> "
134},
135{
136"kind": "keyword",
137"spelling": "static"
138},
139{
140"kind": "text",
141"spelling": " "
142},
143{
144"kind": "typeIdentifier",
145"preciseIdentifier": "c:t0.0",
146"spelling": "T"
147},
148{
149"kind": "text",
150"spelling": " "
151},
152{
153"kind": "identifier",
154"spelling": "Bar"
155},
156{
157"kind": "text",
158"spelling": ";"
159}
160],
161"identifier": {
162"interfaceLanguage": "c++",
163"precise": "c:@S@Foo@Bar"
164},
165"kind": {
166"displayName": "Template Property",
167"identifier": "c++.property"
168},
169"location": {
170"position": {
171"character": 32,
172"line": 1
173},
174"uri": "file://INPUT_DIR/input.h"
175},
176"names": {
177"navigator": [
178{
179"kind": "identifier",
180"spelling": "Bar"
181}
182],
183"subHeading": [
184{
185"kind": "identifier",
186"spelling": "Bar"
187}
188],
189"title": "Bar"
190},
191"pathComponents": [
192"Foo",
193"Bar"
194],
195"swiftGenerics": {
196"parameters": [
197{
198"depth": 0,
199"index": 0,
200"name": "T"
201}
202]
203}
204}
205]
206}
207