[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ExtractAPI / union.c
blob8f8300b2c9a52dcf449289622f0e890986855f38
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 -x c-header\
6 // RUN: %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 /// My Union
15 union Union {
16 /// the a option
17 int a;
18 /// the b option
19 char b;
21 // expected-no-diagnostics
23 //--- reference.output.json.in
25 "metadata": {
26 "formatVersion": {
27 "major": 0,
28 "minor": 5,
29 "patch": 3
31 "generator": "?"
33 "module": {
34 "name": "",
35 "platform": {
36 "architecture": "arm64",
37 "operatingSystem": {
38 "minimumVersion": {
39 "major": 11,
40 "minor": 0,
41 "patch": 0
43 "name": "macosx"
45 "vendor": "apple"
48 "relationships": [
50 "kind": "memberOf",
51 "source": "c:@U@Union@FI@a",
52 "target": "c:@U@Union",
53 "targetFallback": "Union"
56 "kind": "memberOf",
57 "source": "c:@U@Union@FI@b",
58 "target": "c:@U@Union",
59 "targetFallback": "Union"
62 "symbols": [
64 "accessLevel": "public",
65 "declarationFragments": [
67 "kind": "keyword",
68 "spelling": "union"
71 "kind": "text",
72 "spelling": " "
75 "kind": "identifier",
76 "spelling": "Union"
79 "kind": "text",
80 "spelling": ";"
83 "docComment": {
84 "lines": [
86 "range": {
87 "end": {
88 "character": 12,
89 "line": 0
91 "start": {
92 "character": 4,
93 "line": 0
96 "text": "My Union"
100 "identifier": {
101 "interfaceLanguage": "c",
102 "precise": "c:@U@Union"
104 "kind": {
105 "displayName": "Union",
106 "identifier": "c.union"
108 "location": {
109 "position": {
110 "character": 6,
111 "line": 1
113 "uri": "file://INPUT_DIR/input.h"
115 "names": {
116 "navigator": [
118 "kind": "identifier",
119 "spelling": "Union"
122 "subHeading": [
124 "kind": "identifier",
125 "spelling": "Union"
128 "title": "Union"
130 "pathComponents": [
131 "Union"
135 "accessLevel": "public",
136 "declarationFragments": [
138 "kind": "typeIdentifier",
139 "preciseIdentifier": "c:I",
140 "spelling": "int"
143 "kind": "text",
144 "spelling": " "
147 "kind": "identifier",
148 "spelling": "a"
151 "kind": "text",
152 "spelling": ";"
155 "docComment": {
156 "lines": [
158 "range": {
159 "end": {
160 "character": 20,
161 "line": 2
163 "start": {
164 "character": 8,
165 "line": 2
168 "text": "the a option"
172 "identifier": {
173 "interfaceLanguage": "c",
174 "precise": "c:@U@Union@FI@a"
176 "kind": {
177 "displayName": "Instance Property",
178 "identifier": "c.property"
180 "location": {
181 "position": {
182 "character": 8,
183 "line": 3
185 "uri": "file://INPUT_DIR/input.h"
187 "names": {
188 "navigator": [
190 "kind": "identifier",
191 "spelling": "a"
194 "subHeading": [
196 "kind": "identifier",
197 "spelling": "a"
200 "title": "a"
202 "pathComponents": [
203 "Union",
208 "accessLevel": "public",
209 "declarationFragments": [
211 "kind": "typeIdentifier",
212 "preciseIdentifier": "c:C",
213 "spelling": "char"
216 "kind": "text",
217 "spelling": " "
220 "kind": "identifier",
221 "spelling": "b"
224 "kind": "text",
225 "spelling": ";"
228 "docComment": {
229 "lines": [
231 "range": {
232 "end": {
233 "character": 20,
234 "line": 4
236 "start": {
237 "character": 8,
238 "line": 4
241 "text": "the b option"
245 "identifier": {
246 "interfaceLanguage": "c",
247 "precise": "c:@U@Union@FI@b"
249 "kind": {
250 "displayName": "Instance Property",
251 "identifier": "c.property"
253 "location": {
254 "position": {
255 "character": 9,
256 "line": 5
258 "uri": "file://INPUT_DIR/input.h"
260 "names": {
261 "navigator": [
263 "kind": "identifier",
264 "spelling": "b"
267 "subHeading": [
269 "kind": "identifier",
270 "spelling": "b"
273 "title": "b"
275 "pathComponents": [
276 "Union",