xref: /llvm-project/clang/test/ExtractAPI/function_noexcepts.cpp (revision 2bcbe40f8a1c6cc9a256711261d8aa8fde50f7b3)
175f55eb3SErick Velez // RUN: rm -rf %t
275f55eb3SErick Velez // RUN: split-file %s %t
375f55eb3SErick Velez // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
475f55eb3SErick Velez // RUN: %t/reference.output.json.in >> %t/reference.output.json
5*e05c1b46SDaniel Grumberg // RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
675f55eb3SErick Velez // RUN:   -x c++-header %t/input.h -o %t/output.json -verify
775f55eb3SErick Velez 
875f55eb3SErick Velez // Generator version is not consistent across test runs, normalize it.
975f55eb3SErick Velez // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
1075f55eb3SErick Velez // RUN: %t/output.json >> %t/output-normalized.json
1175f55eb3SErick Velez // RUN: diff %t/reference.output.json %t/output-normalized.json
1275f55eb3SErick Velez 
1375f55eb3SErick Velez //--- input.h
1475f55eb3SErick Velez void getFoo() noexcept;
1575f55eb3SErick Velez 
1675f55eb3SErick Velez void getBar() noexcept(true);
1775f55eb3SErick Velez 
1875f55eb3SErick Velez void getFooBar() noexcept(false);
1975f55eb3SErick Velez /// expected-no-diagnostics
2075f55eb3SErick Velez 
2175f55eb3SErick Velez //--- reference.output.json.in
2275f55eb3SErick Velez {
2375f55eb3SErick Velez   "metadata": {
2475f55eb3SErick Velez     "formatVersion": {
2575f55eb3SErick Velez       "major": 0,
2675f55eb3SErick Velez       "minor": 5,
2775f55eb3SErick Velez       "patch": 3
2875f55eb3SErick Velez     },
2975f55eb3SErick Velez     "generator": "?"
3075f55eb3SErick Velez   },
3175f55eb3SErick Velez   "module": {
3275f55eb3SErick Velez     "name": "",
3375f55eb3SErick Velez     "platform": {
3475f55eb3SErick Velez       "architecture": "arm64",
3575f55eb3SErick Velez       "operatingSystem": {
3675f55eb3SErick Velez         "minimumVersion": {
3775f55eb3SErick Velez           "major": 11,
3875f55eb3SErick Velez           "minor": 0,
3975f55eb3SErick Velez           "patch": 0
4075f55eb3SErick Velez         },
4175f55eb3SErick Velez         "name": "macosx"
4275f55eb3SErick Velez       },
4375f55eb3SErick Velez       "vendor": "apple"
4475f55eb3SErick Velez     }
4575f55eb3SErick Velez   },
4675f55eb3SErick Velez   "relationships": [],
4775f55eb3SErick Velez   "symbols": [
4875f55eb3SErick Velez     {
4975f55eb3SErick Velez       "accessLevel": "public",
5075f55eb3SErick Velez       "declarationFragments": [
5175f55eb3SErick Velez         {
5275f55eb3SErick Velez           "kind": "typeIdentifier",
5375f55eb3SErick Velez           "preciseIdentifier": "c:v",
5475f55eb3SErick Velez           "spelling": "void"
5575f55eb3SErick Velez         },
5675f55eb3SErick Velez         {
5775f55eb3SErick Velez           "kind": "text",
5875f55eb3SErick Velez           "spelling": " "
5975f55eb3SErick Velez         },
6075f55eb3SErick Velez         {
6175f55eb3SErick Velez           "kind": "identifier",
6275f55eb3SErick Velez           "spelling": "getFoo"
6375f55eb3SErick Velez         },
6475f55eb3SErick Velez         {
6575f55eb3SErick Velez           "kind": "text",
6675f55eb3SErick Velez           "spelling": "() "
6775f55eb3SErick Velez         },
6875f55eb3SErick Velez         {
6975f55eb3SErick Velez           "kind": "keyword",
7075f55eb3SErick Velez           "spelling": "noexcept"
7175f55eb3SErick Velez         },
7275f55eb3SErick Velez         {
7375f55eb3SErick Velez           "kind": "text",
7475f55eb3SErick Velez           "spelling": ";"
7575f55eb3SErick Velez         }
7675f55eb3SErick Velez       ],
7775f55eb3SErick Velez       "functionSignature": {
7875f55eb3SErick Velez         "returns": [
7975f55eb3SErick Velez           {
8075f55eb3SErick Velez             "kind": "typeIdentifier",
8175f55eb3SErick Velez             "preciseIdentifier": "c:v",
8275f55eb3SErick Velez             "spelling": "void"
8375f55eb3SErick Velez           }
8475f55eb3SErick Velez         ]
8575f55eb3SErick Velez       },
8675f55eb3SErick Velez       "identifier": {
8775f55eb3SErick Velez         "interfaceLanguage": "c++",
8875f55eb3SErick Velez         "precise": "c:@F@getFoo#"
8975f55eb3SErick Velez       },
9075f55eb3SErick Velez       "kind": {
9175f55eb3SErick Velez         "displayName": "Function",
9275f55eb3SErick Velez         "identifier": "c++.func"
9375f55eb3SErick Velez       },
9475f55eb3SErick Velez       "location": {
9575f55eb3SErick Velez         "position": {
9663537872SQuietMisdreavus           "character": 5,
9763537872SQuietMisdreavus           "line": 0
9875f55eb3SErick Velez         },
9975f55eb3SErick Velez         "uri": "file://INPUT_DIR/input.h"
10075f55eb3SErick Velez       },
10175f55eb3SErick Velez       "names": {
10275f55eb3SErick Velez         "navigator": [
10375f55eb3SErick Velez           {
10475f55eb3SErick Velez             "kind": "identifier",
10575f55eb3SErick Velez             "spelling": "getFoo"
10675f55eb3SErick Velez           }
10775f55eb3SErick Velez         ],
10875f55eb3SErick Velez         "subHeading": [
10975f55eb3SErick Velez           {
11075f55eb3SErick Velez             "kind": "identifier",
11175f55eb3SErick Velez             "spelling": "getFoo"
11275f55eb3SErick Velez           }
11375f55eb3SErick Velez         ],
11475f55eb3SErick Velez         "title": "getFoo"
11575f55eb3SErick Velez       },
11675f55eb3SErick Velez       "pathComponents": [
11775f55eb3SErick Velez         "getFoo"
11875f55eb3SErick Velez       ]
11975f55eb3SErick Velez     },
12075f55eb3SErick Velez     {
12175f55eb3SErick Velez       "accessLevel": "public",
12275f55eb3SErick Velez       "declarationFragments": [
12375f55eb3SErick Velez         {
12475f55eb3SErick Velez           "kind": "typeIdentifier",
12575f55eb3SErick Velez           "preciseIdentifier": "c:v",
12675f55eb3SErick Velez           "spelling": "void"
12775f55eb3SErick Velez         },
12875f55eb3SErick Velez         {
12975f55eb3SErick Velez           "kind": "text",
13075f55eb3SErick Velez           "spelling": " "
13175f55eb3SErick Velez         },
13275f55eb3SErick Velez         {
13375f55eb3SErick Velez           "kind": "identifier",
13475f55eb3SErick Velez           "spelling": "getBar"
13575f55eb3SErick Velez         },
13675f55eb3SErick Velez         {
13775f55eb3SErick Velez           "kind": "text",
13875f55eb3SErick Velez           "spelling": "() "
13975f55eb3SErick Velez         },
14075f55eb3SErick Velez         {
14175f55eb3SErick Velez           "kind": "keyword",
14275f55eb3SErick Velez           "spelling": "noexcept"
14375f55eb3SErick Velez         },
14475f55eb3SErick Velez         {
14575f55eb3SErick Velez           "kind": "text",
14675f55eb3SErick Velez           "spelling": "("
14775f55eb3SErick Velez         },
14875f55eb3SErick Velez         {
14975f55eb3SErick Velez           "kind": "keyword",
15075f55eb3SErick Velez           "spelling": "true"
15175f55eb3SErick Velez         },
15275f55eb3SErick Velez         {
15375f55eb3SErick Velez           "kind": "text",
15475f55eb3SErick Velez           "spelling": ");"
15575f55eb3SErick Velez         }
15675f55eb3SErick Velez       ],
15775f55eb3SErick Velez       "functionSignature": {
15875f55eb3SErick Velez         "returns": [
15975f55eb3SErick Velez           {
16075f55eb3SErick Velez             "kind": "typeIdentifier",
16175f55eb3SErick Velez             "preciseIdentifier": "c:v",
16275f55eb3SErick Velez             "spelling": "void"
16375f55eb3SErick Velez           }
16475f55eb3SErick Velez         ]
16575f55eb3SErick Velez       },
16675f55eb3SErick Velez       "identifier": {
16775f55eb3SErick Velez         "interfaceLanguage": "c++",
16875f55eb3SErick Velez         "precise": "c:@F@getBar#"
16975f55eb3SErick Velez       },
17075f55eb3SErick Velez       "kind": {
17175f55eb3SErick Velez         "displayName": "Function",
17275f55eb3SErick Velez         "identifier": "c++.func"
17375f55eb3SErick Velez       },
17475f55eb3SErick Velez       "location": {
17575f55eb3SErick Velez         "position": {
17663537872SQuietMisdreavus           "character": 5,
17763537872SQuietMisdreavus           "line": 2
17875f55eb3SErick Velez         },
17975f55eb3SErick Velez         "uri": "file://INPUT_DIR/input.h"
18075f55eb3SErick Velez       },
18175f55eb3SErick Velez       "names": {
18275f55eb3SErick Velez         "navigator": [
18375f55eb3SErick Velez           {
18475f55eb3SErick Velez             "kind": "identifier",
18575f55eb3SErick Velez             "spelling": "getBar"
18675f55eb3SErick Velez           }
18775f55eb3SErick Velez         ],
18875f55eb3SErick Velez         "subHeading": [
18975f55eb3SErick Velez           {
19075f55eb3SErick Velez             "kind": "identifier",
19175f55eb3SErick Velez             "spelling": "getBar"
19275f55eb3SErick Velez           }
19375f55eb3SErick Velez         ],
19475f55eb3SErick Velez         "title": "getBar"
19575f55eb3SErick Velez       },
19675f55eb3SErick Velez       "pathComponents": [
19775f55eb3SErick Velez         "getBar"
19875f55eb3SErick Velez       ]
19975f55eb3SErick Velez     },
20075f55eb3SErick Velez     {
20175f55eb3SErick Velez       "accessLevel": "public",
20275f55eb3SErick Velez       "declarationFragments": [
20375f55eb3SErick Velez         {
20475f55eb3SErick Velez           "kind": "typeIdentifier",
20575f55eb3SErick Velez           "preciseIdentifier": "c:v",
20675f55eb3SErick Velez           "spelling": "void"
20775f55eb3SErick Velez         },
20875f55eb3SErick Velez         {
20975f55eb3SErick Velez           "kind": "text",
21075f55eb3SErick Velez           "spelling": " "
21175f55eb3SErick Velez         },
21275f55eb3SErick Velez         {
21375f55eb3SErick Velez           "kind": "identifier",
21475f55eb3SErick Velez           "spelling": "getFooBar"
21575f55eb3SErick Velez         },
21675f55eb3SErick Velez         {
21775f55eb3SErick Velez           "kind": "text",
21875f55eb3SErick Velez           "spelling": "() "
21975f55eb3SErick Velez         },
22075f55eb3SErick Velez         {
22175f55eb3SErick Velez           "kind": "keyword",
22275f55eb3SErick Velez           "spelling": "noexcept"
22375f55eb3SErick Velez         },
22475f55eb3SErick Velez         {
22575f55eb3SErick Velez           "kind": "text",
22675f55eb3SErick Velez           "spelling": "("
22775f55eb3SErick Velez         },
22875f55eb3SErick Velez         {
22975f55eb3SErick Velez           "kind": "keyword",
23075f55eb3SErick Velez           "spelling": "false"
23175f55eb3SErick Velez         },
23275f55eb3SErick Velez         {
23375f55eb3SErick Velez           "kind": "text",
23475f55eb3SErick Velez           "spelling": ");"
23575f55eb3SErick Velez         }
23675f55eb3SErick Velez       ],
23775f55eb3SErick Velez       "functionSignature": {
23875f55eb3SErick Velez         "returns": [
23975f55eb3SErick Velez           {
24075f55eb3SErick Velez             "kind": "typeIdentifier",
24175f55eb3SErick Velez             "preciseIdentifier": "c:v",
24275f55eb3SErick Velez             "spelling": "void"
24375f55eb3SErick Velez           }
24475f55eb3SErick Velez         ]
24575f55eb3SErick Velez       },
24675f55eb3SErick Velez       "identifier": {
24775f55eb3SErick Velez         "interfaceLanguage": "c++",
24875f55eb3SErick Velez         "precise": "c:@F@getFooBar#"
24975f55eb3SErick Velez       },
25075f55eb3SErick Velez       "kind": {
25175f55eb3SErick Velez         "displayName": "Function",
25275f55eb3SErick Velez         "identifier": "c++.func"
25375f55eb3SErick Velez       },
25475f55eb3SErick Velez       "location": {
25575f55eb3SErick Velez         "position": {
25663537872SQuietMisdreavus           "character": 5,
25763537872SQuietMisdreavus           "line": 4
25875f55eb3SErick Velez         },
25975f55eb3SErick Velez         "uri": "file://INPUT_DIR/input.h"
26075f55eb3SErick Velez       },
26175f55eb3SErick Velez       "names": {
26275f55eb3SErick Velez         "navigator": [
26375f55eb3SErick Velez           {
26475f55eb3SErick Velez             "kind": "identifier",
26575f55eb3SErick Velez             "spelling": "getFooBar"
26675f55eb3SErick Velez           }
26775f55eb3SErick Velez         ],
26875f55eb3SErick Velez         "subHeading": [
26975f55eb3SErick Velez           {
27075f55eb3SErick Velez             "kind": "identifier",
27175f55eb3SErick Velez             "spelling": "getFooBar"
27275f55eb3SErick Velez           }
27375f55eb3SErick Velez         ],
27475f55eb3SErick Velez         "title": "getFooBar"
27575f55eb3SErick Velez       },
27675f55eb3SErick Velez       "pathComponents": [
27775f55eb3SErick Velez         "getFooBar"
27875f55eb3SErick Velez       ]
27975f55eb3SErick Velez     }
28075f55eb3SErick Velez   ]
28175f55eb3SErick Velez }
282