[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ExtractAPI / global_var_template_spec.cpp
blobe465da97db1f22c81278a034ef053280f2b375a8
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 T> T Foo = T(3.14);
16 template<> int Foo<int>;
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": "T"
70 "kind": "text",
71 "spelling": "> "
74 "kind": "typeIdentifier",
75 "preciseIdentifier": "c:t0.0",
76 "spelling": "T"
79 "kind": "text",
80 "spelling": " "
83 "kind": "identifier",
84 "spelling": "Foo"
87 "kind": "text",
88 "spelling": ";"
91 "identifier": {
92 "interfaceLanguage": "c++",
93 "precise": "c:@Foo"
95 "kind": {
96 "displayName": "Global Variable Template",
97 "identifier": "c++.var"
99 "location": {
100 "position": {
101 "character": 23,
102 "line": 0
104 "uri": "file://INPUT_DIR/input.h"
106 "names": {
107 "navigator": [
109 "kind": "identifier",
110 "spelling": "Foo"
113 "subHeading": [
115 "kind": "identifier",
116 "spelling": "Foo"
119 "title": "Foo"
121 "pathComponents": [
122 "Foo"
124 "swiftGenerics": {
125 "parameters": [
127 "depth": 0,
128 "index": 0,
129 "name": "T"
135 "accessLevel": "public",
136 "declarationFragments": [
138 "kind": "keyword",
139 "spelling": "template"
142 "kind": "text",
143 "spelling": " <> "
146 "kind": "typeIdentifier",
147 "preciseIdentifier": "c:I",
148 "spelling": "int"
151 "kind": "text",
152 "spelling": " "
155 "kind": "identifier",
156 "spelling": "Foo"
159 "kind": "text",
160 "spelling": "<"
163 "kind": "typeIdentifier",
164 "preciseIdentifier": "c:I",
165 "spelling": "int"
168 "kind": "text",
169 "spelling": ">;"
172 "identifier": {
173 "interfaceLanguage": "c++",
174 "precise": "c:@Foo>#I"
176 "kind": {
177 "displayName": "Global Variable Template Specialization",
178 "identifier": "c++.var"
180 "location": {
181 "position": {
182 "character": 15,
183 "line": 2
185 "uri": "file://INPUT_DIR/input.h"
187 "names": {
188 "navigator": [
190 "kind": "identifier",
191 "spelling": "Foo"
194 "subHeading": [
196 "kind": "identifier",
197 "spelling": "Foo"
200 "title": "Foo"
202 "pathComponents": [
203 "Foo"