[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / ExtractAPI / macro_undefined.c
blobc7d3dd6cfea8cab1c4e499df0523c277baaa1930
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 -extract-api --product-name=Macros -target arm64-apple-macosx \
6 // RUN: -x objective-c-header %t/input.h -o %t/output.json | FileCheck -allow-empty %s
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 // CHECK-NOT: error:
14 // CHECK-NOT: warning:
16 //--- input.h
17 #define HELLO 1
18 #define FUNC_GEN(NAME, ...) void NAME(__VA_ARGS__);
19 FUNC_GEN(foo)
20 FUNC_GEN(bar, const int *, unsigned);
21 #undef FUNC_GEN
22 // Undefining a not previously defined macro should not result in a crash.
23 #undef FOO
25 //--- reference.output.json.in
27 "metadata": {
28 "formatVersion": {
29 "major": 0,
30 "minor": 5,
31 "patch": 3
33 "generator": "?"
35 "module": {
36 "name": "Macros",
37 "platform": {
38 "architecture": "arm64",
39 "operatingSystem": {
40 "minimumVersion": {
41 "major": 11,
42 "minor": 0,
43 "patch": 0
45 "name": "macosx"
47 "vendor": "apple"
50 "relationships": [],
51 "symbols": [
53 "accessLevel": "public",
54 "declarationFragments": [
56 "kind": "typeIdentifier",
57 "preciseIdentifier": "c:v",
58 "spelling": "void"
61 "kind": "text",
62 "spelling": " "
65 "kind": "identifier",
66 "spelling": "foo"
69 "kind": "text",
70 "spelling": "()"
73 "functionSignature": {
74 "returns": [
76 "kind": "typeIdentifier",
77 "preciseIdentifier": "c:v",
78 "spelling": "void"
82 "identifier": {
83 "interfaceLanguage": "objective-c",
84 "precise": "c:@F@foo"
86 "kind": {
87 "displayName": "Function",
88 "identifier": "objective-c.func"
90 "location": {
91 "position": {
92 "character": 1,
93 "line": 3
95 "uri": "file://INPUT_DIR/input.h"
97 "names": {
98 "navigator": [
100 "kind": "identifier",
101 "spelling": "foo"
104 "subHeading": [
106 "kind": "identifier",
107 "spelling": "foo"
110 "title": "foo"
112 "pathComponents": [
113 "foo"
117 "accessLevel": "public",
118 "declarationFragments": [
120 "kind": "typeIdentifier",
121 "preciseIdentifier": "c:v",
122 "spelling": "void"
125 "kind": "text",
126 "spelling": " "
129 "kind": "identifier",
130 "spelling": "bar"
133 "kind": "text",
134 "spelling": "("
137 "kind": "keyword",
138 "spelling": "const"
141 "kind": "text",
142 "spelling": " "
145 "kind": "typeIdentifier",
146 "preciseIdentifier": "c:I",
147 "spelling": "int"
150 "kind": "text",
151 "spelling": " * "
154 "kind": "internalParam",
155 "spelling": ""
158 "kind": "text",
159 "spelling": ", "
162 "kind": "typeIdentifier",
163 "preciseIdentifier": "c:i",
164 "spelling": "unsigned int"
167 "kind": "text",
168 "spelling": " "
171 "kind": "internalParam",
172 "spelling": ""
175 "kind": "text",
176 "spelling": ")"
179 "functionSignature": {
180 "parameters": [
182 "declarationFragments": [
184 "kind": "keyword",
185 "spelling": "const"
188 "kind": "text",
189 "spelling": " "
192 "kind": "typeIdentifier",
193 "preciseIdentifier": "c:I",
194 "spelling": "int"
197 "kind": "text",
198 "spelling": " * "
201 "kind": "internalParam",
202 "spelling": ""
205 "name": ""
208 "declarationFragments": [
210 "kind": "typeIdentifier",
211 "preciseIdentifier": "c:i",
212 "spelling": "unsigned int"
215 "kind": "text",
216 "spelling": " "
219 "kind": "internalParam",
220 "spelling": ""
223 "name": ""
226 "returns": [
228 "kind": "typeIdentifier",
229 "preciseIdentifier": "c:v",
230 "spelling": "void"
234 "identifier": {
235 "interfaceLanguage": "objective-c",
236 "precise": "c:@F@bar"
238 "kind": {
239 "displayName": "Function",
240 "identifier": "objective-c.func"
242 "location": {
243 "position": {
244 "character": 1,
245 "line": 4
247 "uri": "file://INPUT_DIR/input.h"
249 "names": {
250 "navigator": [
252 "kind": "identifier",
253 "spelling": "bar"
256 "subHeading": [
258 "kind": "identifier",
259 "spelling": "bar"
262 "title": "bar"
264 "pathComponents": [
265 "bar"
269 "accessLevel": "public",
270 "declarationFragments": [
272 "kind": "keyword",
273 "spelling": "#define"
276 "kind": "text",
277 "spelling": " "
280 "kind": "identifier",
281 "spelling": "HELLO"
284 "identifier": {
285 "interfaceLanguage": "objective-c",
286 "precise": "c:input.h@8@macro@HELLO"
288 "kind": {
289 "displayName": "Macro",
290 "identifier": "objective-c.macro"
292 "location": {
293 "position": {
294 "character": 9,
295 "line": 1
297 "uri": "file://INPUT_DIR/input.h"
299 "names": {
300 "navigator": [
302 "kind": "identifier",
303 "spelling": "HELLO"
306 "subHeading": [
308 "kind": "identifier",
309 "spelling": "HELLO"
312 "title": "HELLO"
314 "pathComponents": [
315 "HELLO"