[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ExtractAPI / field_template.cpp
blob973a9de5c9986b572155f1dbcba06825d6f6b031
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 class Foo {
15 template<typename T> static T Bar;
18 /// expected-no-diagnostics
20 //--- reference.output.json.in
22 "metadata": {
23 "formatVersion": {
24 "major": 0,
25 "minor": 5,
26 "patch": 3
28 "generator": "?"
30 "module": {
31 "name": "",
32 "platform": {
33 "architecture": "arm64",
34 "operatingSystem": {
35 "minimumVersion": {
36 "major": 11,
37 "minor": 0,
38 "patch": 0
40 "name": "macosx"
42 "vendor": "apple"
45 "relationships": [
47 "kind": "memberOf",
48 "source": "c:@S@Foo@Bar",
49 "target": "c:@S@Foo",
50 "targetFallback": "Foo"
53 "symbols": [
55 "accessLevel": "public",
56 "declarationFragments": [
58 "kind": "keyword",
59 "spelling": "class"
62 "kind": "text",
63 "spelling": " "
66 "kind": "identifier",
67 "spelling": "Foo"
70 "kind": "text",
71 "spelling": ";"
74 "identifier": {
75 "interfaceLanguage": "c++",
76 "precise": "c:@S@Foo"
78 "kind": {
79 "displayName": "Class",
80 "identifier": "c++.class"
82 "location": {
83 "position": {
84 "character": 6,
85 "line": 0
87 "uri": "file://INPUT_DIR/input.h"
89 "names": {
90 "navigator": [
92 "kind": "identifier",
93 "spelling": "Foo"
96 "subHeading": [
98 "kind": "identifier",
99 "spelling": "Foo"
102 "title": "Foo"
104 "pathComponents": [
105 "Foo"
109 "accessLevel": "private",
110 "declarationFragments": [
112 "kind": "keyword",
113 "spelling": "template"
116 "kind": "text",
117 "spelling": " <"
120 "kind": "keyword",
121 "spelling": "typename"
124 "kind": "text",
125 "spelling": " "
128 "kind": "genericParameter",
129 "spelling": "T"
132 "kind": "text",
133 "spelling": "> "
136 "kind": "keyword",
137 "spelling": "static"
140 "kind": "text",
141 "spelling": " "
144 "kind": "typeIdentifier",
145 "preciseIdentifier": "c:t0.0",
146 "spelling": "T"
149 "kind": "text",
150 "spelling": " "
153 "kind": "identifier",
154 "spelling": "Bar"
157 "kind": "text",
158 "spelling": ";"
161 "identifier": {
162 "interfaceLanguage": "c++",
163 "precise": "c:@S@Foo@Bar"
165 "kind": {
166 "displayName": "Template Property",
167 "identifier": "c++.property"
169 "location": {
170 "position": {
171 "character": 32,
172 "line": 1
174 "uri": "file://INPUT_DIR/input.h"
176 "names": {
177 "navigator": [
179 "kind": "identifier",
180 "spelling": "Bar"
183 "subHeading": [
185 "kind": "identifier",
186 "spelling": "Bar"
189 "title": "Bar"
191 "pathComponents": [
192 "Foo",
193 "Bar"
195 "swiftGenerics": {
196 "parameters": [
198 "depth": 0,
199 "index": 0,
200 "name": "T"