Debian Codegraph @

clang/test/ExtractAPI/namespace.cpp

raw
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
7
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
12
13 //--- input.h
14 namespace Foo {
15 class Bar { };
16 }
17
18 /// expected-no-diagnostics
19
20 //--- reference.output.json.in
21 {
22 "metadata": {
23 "formatVersion": {
24 "major": 0,
25 "minor": 5,
26 "patch": 3
27 },
28 "generator": "?"
29 },
30 "module": {
31 "name": "",
32 "platform": {
33 "architecture": "arm64",
34 "operatingSystem": {
35 "minimumVersion": {
36 "major": 11,
37 "minor": 0,
38 "patch": 0
39 },
40 "name": "macosx"
41 },
42 "vendor": "apple"
43 }
44 },
45 "relationships": [
46 {
47 "kind": "memberOf",
48 "source": "c:@N@Foo@S@Bar",
49 "target": "c:@N@Foo",
50 "targetFallback": "Foo"
51 }
52 ],
53 "symbols": [
54 {
55 "accessLevel": "public",
56 "declarationFragments": [
57 {
58 "kind": "keyword",
59 "spelling": "namespace"
60 },
61 {
62 "kind": "text",
63 "spelling": " "
64 },
65 {
66 "kind": "identifier",
67 "spelling": "Foo"
68 },
69 {
70 "kind": "text",
71 "spelling": ";"
72 }
73 ],
74 "identifier": {
75 "interfaceLanguage": "c++",
76 "precise": "c:@N@Foo"
77 },
78 "kind": {
79 "displayName": "Namespace",
80 "identifier": "c++.namespace"
81 },
82 "location": {
83 "position": {
84 "character": 10,
85 "line": 0
86 },
87 "uri": "file://INPUT_DIR/input.h"
88 },
89 "names": {
90 "navigator": [
91 {
92 "kind": "identifier",
93 "spelling": "Foo"
94 }
95 ],
96 "subHeading": [
97 {
98 "kind": "identifier",
99 "spelling": "Foo"
100 }
101 ],
102 "title": "Foo"
103 },
104 "pathComponents": [
105 "Foo"
106 ]
107 },
108 {
109 "accessLevel": "public",
110 "declarationFragments": [
111 {
112 "kind": "keyword",
113 "spelling": "class"
114 },
115 {
116 "kind": "text",
117 "spelling": " "
118 },
119 {
120 "kind": "identifier",
121 "spelling": "Bar"
122 },
123 {
124 "kind": "text",
125 "spelling": ";"
126 }
127 ],
128 "identifier": {
129 "interfaceLanguage": "c++",
130 "precise": "c:@N@Foo@S@Bar"
131 },
132 "kind": {
133 "displayName": "Class",
134 "identifier": "c++.class"
135 },
136 "location": {
137 "position": {
138 "character": 8,
139 "line": 1
140 },
141 "uri": "file://INPUT_DIR/input.h"
142 },
143 "names": {
144 "navigator": [
145 {
146 "kind": "identifier",
147 "spelling": "Bar"
148 }
149 ],
150 "subHeading": [
151 {
152 "kind": "identifier",
153 "spelling": "Bar"
154 }
155 ],
156 "title": "Bar"
157 },
158 "pathComponents": [
159 "Foo",
160 "Bar"
161 ]
162 }
163 ]
164 }