Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / ExtractAPI / function_noexcepts.cpp
blob0ce4dd2e43e51009a5882c8196c9e67eece54d00
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 -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 void getFoo() noexcept;
16 void getBar() noexcept(true);
18 void getFooBar() noexcept(false);
19 /// expected-no-diagnostics
21 //--- reference.output.json.in
23 "metadata": {
24 "formatVersion": {
25 "major": 0,
26 "minor": 5,
27 "patch": 3
29 "generator": "?"
31 "module": {
32 "name": "",
33 "platform": {
34 "architecture": "arm64",
35 "operatingSystem": {
36 "minimumVersion": {
37 "major": 11,
38 "minor": 0,
39 "patch": 0
41 "name": "macosx"
43 "vendor": "apple"
46 "relationships": [],
47 "symbols": [
49 "accessLevel": "public",
50 "declarationFragments": [
52 "kind": "typeIdentifier",
53 "preciseIdentifier": "c:v",
54 "spelling": "void"
57 "kind": "text",
58 "spelling": " "
61 "kind": "identifier",
62 "spelling": "getFoo"
65 "kind": "text",
66 "spelling": "()"
69 "kind": "text",
70 "spelling": " "
73 "kind": "keyword",
74 "spelling": "noexcept"
77 "kind": "text",
78 "spelling": ";"
81 "functionSignature": {
82 "returns": [
84 "kind": "typeIdentifier",
85 "preciseIdentifier": "c:v",
86 "spelling": "void"
90 "identifier": {
91 "interfaceLanguage": "c++",
92 "precise": "c:@F@getFoo#"
94 "kind": {
95 "displayName": "Function",
96 "identifier": "c++.func"
98 "location": {
99 "position": {
100 "character": 6,
101 "line": 1
103 "uri": "file://INPUT_DIR/input.h"
105 "names": {
106 "navigator": [
108 "kind": "identifier",
109 "spelling": "getFoo"
112 "subHeading": [
114 "kind": "identifier",
115 "spelling": "getFoo"
118 "title": "getFoo"
120 "pathComponents": [
121 "getFoo"
125 "accessLevel": "public",
126 "declarationFragments": [
128 "kind": "typeIdentifier",
129 "preciseIdentifier": "c:v",
130 "spelling": "void"
133 "kind": "text",
134 "spelling": " "
137 "kind": "identifier",
138 "spelling": "getBar"
141 "kind": "text",
142 "spelling": "()"
145 "kind": "text",
146 "spelling": " "
149 "kind": "keyword",
150 "spelling": "noexcept"
153 "kind": "text",
154 "spelling": "("
157 "kind": "keyword",
158 "spelling": "true"
161 "kind": "text",
162 "spelling": ");"
165 "functionSignature": {
166 "returns": [
168 "kind": "typeIdentifier",
169 "preciseIdentifier": "c:v",
170 "spelling": "void"
174 "identifier": {
175 "interfaceLanguage": "c++",
176 "precise": "c:@F@getBar#"
178 "kind": {
179 "displayName": "Function",
180 "identifier": "c++.func"
182 "location": {
183 "position": {
184 "character": 6,
185 "line": 3
187 "uri": "file://INPUT_DIR/input.h"
189 "names": {
190 "navigator": [
192 "kind": "identifier",
193 "spelling": "getBar"
196 "subHeading": [
198 "kind": "identifier",
199 "spelling": "getBar"
202 "title": "getBar"
204 "pathComponents": [
205 "getBar"
209 "accessLevel": "public",
210 "declarationFragments": [
212 "kind": "typeIdentifier",
213 "preciseIdentifier": "c:v",
214 "spelling": "void"
217 "kind": "text",
218 "spelling": " "
221 "kind": "identifier",
222 "spelling": "getFooBar"
225 "kind": "text",
226 "spelling": "()"
229 "kind": "text",
230 "spelling": " "
233 "kind": "keyword",
234 "spelling": "noexcept"
237 "kind": "text",
238 "spelling": "("
241 "kind": "keyword",
242 "spelling": "false"
245 "kind": "text",
246 "spelling": ");"
249 "functionSignature": {
250 "returns": [
252 "kind": "typeIdentifier",
253 "preciseIdentifier": "c:v",
254 "spelling": "void"
258 "identifier": {
259 "interfaceLanguage": "c++",
260 "precise": "c:@F@getFooBar#"
262 "kind": {
263 "displayName": "Function",
264 "identifier": "c++.func"
266 "location": {
267 "position": {
268 "character": 6,
269 "line": 5
271 "uri": "file://INPUT_DIR/input.h"
273 "names": {
274 "navigator": [
276 "kind": "identifier",
277 "spelling": "getFooBar"
280 "subHeading": [
282 "kind": "identifier",
283 "spelling": "getFooBar"
286 "title": "getFooBar"
288 "pathComponents": [
289 "getFooBar"