[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ExtractAPI / conversions.cpp
blob07688ff770979e54a7cd18bce2392eddc1abb3bf
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 operator int();
16 explicit operator double();
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@F@operator int#",
49 "target": "c:@S@Foo",
50 "targetFallback": "Foo"
53 "kind": "memberOf",
54 "source": "c:@S@Foo@F@operator double#",
55 "target": "c:@S@Foo",
56 "targetFallback": "Foo"
59 "symbols": [
61 "accessLevel": "public",
62 "declarationFragments": [
64 "kind": "keyword",
65 "spelling": "class"
68 "kind": "text",
69 "spelling": " "
72 "kind": "identifier",
73 "spelling": "Foo"
76 "kind": "text",
77 "spelling": ";"
80 "identifier": {
81 "interfaceLanguage": "c++",
82 "precise": "c:@S@Foo"
84 "kind": {
85 "displayName": "Class",
86 "identifier": "c++.class"
88 "location": {
89 "position": {
90 "character": 6,
91 "line": 0
93 "uri": "file://INPUT_DIR/input.h"
95 "names": {
96 "navigator": [
98 "kind": "identifier",
99 "spelling": "Foo"
102 "subHeading": [
104 "kind": "identifier",
105 "spelling": "Foo"
108 "title": "Foo"
110 "pathComponents": [
111 "Foo"
115 "accessLevel": "private",
116 "declarationFragments": [
118 "kind": "keyword",
119 "spelling": "operator"
122 "kind": "text",
123 "spelling": " "
126 "kind": "typeIdentifier",
127 "spelling": "int"
130 "kind": "text",
131 "spelling": "();"
134 "functionSignature": {
135 "returns": [
137 "kind": "typeIdentifier",
138 "preciseIdentifier": "c:I",
139 "spelling": "int"
143 "identifier": {
144 "interfaceLanguage": "c++",
145 "precise": "c:@S@Foo@F@operator int#"
147 "kind": {
148 "displayName": "Instance Method",
149 "identifier": "c++.method"
151 "location": {
152 "position": {
153 "character": 2,
154 "line": 1
156 "uri": "file://INPUT_DIR/input.h"
158 "names": {
159 "navigator": [
161 "kind": "identifier",
162 "spelling": "operator int"
165 "subHeading": [
167 "kind": "identifier",
168 "spelling": "int"
171 "title": "operator int"
173 "pathComponents": [
174 "Foo",
175 "operator int"
179 "accessLevel": "private",
180 "declarationFragments": [
182 "kind": "keyword",
183 "spelling": "explicit"
186 "kind": "text",
187 "spelling": " "
190 "kind": "keyword",
191 "spelling": "operator"
194 "kind": "text",
195 "spelling": " "
198 "kind": "typeIdentifier",
199 "spelling": "double"
202 "kind": "text",
203 "spelling": "();"
206 "functionSignature": {
207 "returns": [
209 "kind": "typeIdentifier",
210 "preciseIdentifier": "c:d",
211 "spelling": "double"
215 "identifier": {
216 "interfaceLanguage": "c++",
217 "precise": "c:@S@Foo@F@operator double#"
219 "kind": {
220 "displayName": "Instance Method",
221 "identifier": "c++.method"
223 "location": {
224 "position": {
225 "character": 11,
226 "line": 2
228 "uri": "file://INPUT_DIR/input.h"
230 "names": {
231 "navigator": [
233 "kind": "identifier",
234 "spelling": "operator double"
237 "subHeading": [
239 "kind": "identifier",
240 "spelling": "double"
243 "title": "operator double"
245 "pathComponents": [
246 "Foo",
247 "operator double"