[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ExtractAPI / bool.cpp
blobf7d10c61dba4b7ba74507b8edaa6b740466b76a3
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 bool Foo;
16 bool IsFoo(bool Bar);
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": "typeIdentifier",
51 "preciseIdentifier": "c:b",
52 "spelling": "bool"
55 "kind": "text",
56 "spelling": " "
59 "kind": "identifier",
60 "spelling": "Foo"
63 "kind": "text",
64 "spelling": ";"
67 "identifier": {
68 "interfaceLanguage": "c++",
69 "precise": "c:@Foo"
71 "kind": {
72 "displayName": "Global Variable",
73 "identifier": "c++.var"
75 "location": {
76 "position": {
77 "character": 5,
78 "line": 0
80 "uri": "file://INPUT_DIR/input.h"
82 "names": {
83 "navigator": [
85 "kind": "identifier",
86 "spelling": "Foo"
89 "subHeading": [
91 "kind": "identifier",
92 "spelling": "Foo"
95 "title": "Foo"
97 "pathComponents": [
98 "Foo"
102 "accessLevel": "public",
103 "declarationFragments": [
105 "kind": "typeIdentifier",
106 "preciseIdentifier": "c:b",
107 "spelling": "bool"
110 "kind": "text",
111 "spelling": " "
114 "kind": "identifier",
115 "spelling": "IsFoo"
118 "kind": "text",
119 "spelling": "("
122 "kind": "typeIdentifier",
123 "preciseIdentifier": "c:b",
124 "spelling": "bool"
127 "kind": "text",
128 "spelling": " "
131 "kind": "internalParam",
132 "spelling": "Bar"
135 "kind": "text",
136 "spelling": ");"
139 "functionSignature": {
140 "parameters": [
142 "declarationFragments": [
144 "kind": "typeIdentifier",
145 "preciseIdentifier": "c:b",
146 "spelling": "bool"
149 "kind": "text",
150 "spelling": " "
153 "kind": "internalParam",
154 "spelling": "Bar"
157 "name": "Bar"
160 "returns": [
162 "kind": "typeIdentifier",
163 "preciseIdentifier": "c:b",
164 "spelling": "bool"
168 "identifier": {
169 "interfaceLanguage": "c++",
170 "precise": "c:@F@IsFoo#b#"
172 "kind": {
173 "displayName": "Function",
174 "identifier": "c++.func"
176 "location": {
177 "position": {
178 "character": 5,
179 "line": 2
181 "uri": "file://INPUT_DIR/input.h"
183 "names": {
184 "navigator": [
186 "kind": "identifier",
187 "spelling": "IsFoo"
190 "subHeading": [
192 "kind": "identifier",
193 "spelling": "IsFoo"
196 "title": "IsFoo"
198 "pathComponents": [
199 "IsFoo"