[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ExtractAPI / global_var_template_partial_spec.cpp
blobffb1557fd7580065cb92aa67696a0577a8592a34
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
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 template<typename X, typename Y> int Foo = 0;
16 template<typename Z> int Foo<int, Z> = 0;
17 /// expected-no-diagnostics
19 //--- reference.output.json.in
21 "metadata": {
22 "formatVersion": {
23 "major": 0,
24 "minor": 5,
25 "patch": 3
27 "generator": "?"
29 "module": {
30 "name": "",
31 "platform": {
32 "architecture": "arm64",
33 "operatingSystem": {
34 "minimumVersion": {
35 "major": 11,
36 "minor": 0,
37 "patch": 0
39 "name": "macosx"
41 "vendor": "apple"
44 "relationships": [],
45 "symbols": [
47 "accessLevel": "public",
48 "declarationFragments": [
50 "kind": "keyword",
51 "spelling": "template"
54 "kind": "text",
55 "spelling": " <"
58 "kind": "keyword",
59 "spelling": "typename"
62 "kind": "text",
63 "spelling": " "
66 "kind": "genericParameter",
67 "spelling": "X"
70 "kind": "text",
71 "spelling": ", "
74 "kind": "keyword",
75 "spelling": "typename"
78 "kind": "text",
79 "spelling": " "
82 "kind": "genericParameter",
83 "spelling": "Y"
86 "kind": "text",
87 "spelling": "> "
90 "kind": "typeIdentifier",
91 "preciseIdentifier": "c:I",
92 "spelling": "int"
95 "kind": "text",
96 "spelling": " "
99 "kind": "identifier",
100 "spelling": "Foo"
103 "kind": "text",
104 "spelling": ";"
107 "identifier": {
108 "interfaceLanguage": "c++",
109 "precise": "c:@Foo"
111 "kind": {
112 "displayName": "Global Variable Template",
113 "identifier": "c++.var"
115 "location": {
116 "position": {
117 "character": 37,
118 "line": 0
120 "uri": "file://INPUT_DIR/input.h"
122 "names": {
123 "navigator": [
125 "kind": "identifier",
126 "spelling": "Foo"
129 "subHeading": [
131 "kind": "identifier",
132 "spelling": "Foo"
135 "title": "Foo"
137 "pathComponents": [
138 "Foo"
140 "swiftGenerics": {
141 "parameters": [
143 "depth": 0,
144 "index": 0,
145 "name": "X"
148 "depth": 0,
149 "index": 1,
150 "name": "Y"
156 "accessLevel": "public",
157 "declarationFragments": [
159 "kind": "keyword",
160 "spelling": "template"
163 "kind": "text",
164 "spelling": " <"
167 "kind": "keyword",
168 "spelling": "typename"
171 "kind": "text",
172 "spelling": " "
175 "kind": "genericParameter",
176 "spelling": "Z"
179 "kind": "text",
180 "spelling": "> "
183 "kind": "typeIdentifier",
184 "preciseIdentifier": "c:I",
185 "spelling": "int"
188 "kind": "text",
189 "spelling": " "
192 "kind": "identifier",
193 "spelling": "Foo"
196 "kind": "text",
197 "spelling": "<"
200 "kind": "typeIdentifier",
201 "preciseIdentifier": "c:I",
202 "spelling": "int"
205 "kind": "text",
206 "spelling": ", "
209 "kind": "typeIdentifier",
210 "preciseIdentifier": "c:t0.0",
211 "spelling": "Z"
214 "kind": "text",
215 "spelling": ">;"
218 "identifier": {
219 "interfaceLanguage": "c++",
220 "precise": "c:@VP>1#T@Foo>#I#t0.0"
222 "kind": {
223 "displayName": "Global Variable Template Partial Specialization",
224 "identifier": "c++.var"
226 "location": {
227 "position": {
228 "character": 25,
229 "line": 2
231 "uri": "file://INPUT_DIR/input.h"
233 "names": {
234 "navigator": [
236 "kind": "identifier",
237 "spelling": "Foo"
240 "subHeading": [
242 "kind": "identifier",
243 "spelling": "Foo"
246 "title": "Foo"
248 "pathComponents": [
249 "Foo"
251 "swiftGenerics": {
252 "parameters": [
254 "depth": 0,
255 "index": 0,
256 "name": "Z"