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