[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ExtractAPI / simple_inheritance.cpp
blob58c3c4e1e5cb8a9bdccf6b1c31fc5b51abb4130e
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 {};
16 class Bar : public Foo {};
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": [
46 "kind": "inheritsFrom",
47 "source": "c:@S@Bar",
48 "target": "c:@S@Foo",
49 "targetFallback": "Foo"
52 "symbols": [
54 "accessLevel": "public",
55 "declarationFragments": [
57 "kind": "keyword",
58 "spelling": "class"
61 "kind": "text",
62 "spelling": " "
65 "kind": "identifier",
66 "spelling": "Foo"
69 "kind": "text",
70 "spelling": ";"
73 "identifier": {
74 "interfaceLanguage": "c++",
75 "precise": "c:@S@Foo"
77 "kind": {
78 "displayName": "Class",
79 "identifier": "c++.class"
81 "location": {
82 "position": {
83 "character": 6,
84 "line": 0
86 "uri": "file://INPUT_DIR/input.h"
88 "names": {
89 "navigator": [
91 "kind": "identifier",
92 "spelling": "Foo"
95 "subHeading": [
97 "kind": "identifier",
98 "spelling": "Foo"
101 "title": "Foo"
103 "pathComponents": [
104 "Foo"
108 "accessLevel": "public",
109 "declarationFragments": [
111 "kind": "keyword",
112 "spelling": "class"
115 "kind": "text",
116 "spelling": " "
119 "kind": "identifier",
120 "spelling": "Bar"
123 "kind": "text",
124 "spelling": ";"
127 "identifier": {
128 "interfaceLanguage": "c++",
129 "precise": "c:@S@Bar"
131 "kind": {
132 "displayName": "Class",
133 "identifier": "c++.class"
135 "location": {
136 "position": {
137 "character": 6,
138 "line": 2
140 "uri": "file://INPUT_DIR/input.h"
142 "names": {
143 "navigator": [
145 "kind": "identifier",
146 "spelling": "Bar"
149 "subHeading": [
151 "kind": "identifier",
152 "spelling": "Bar"
155 "title": "Bar"
157 "pathComponents": [
158 "Bar"