1 // RUN: rm -rf %t 2 // RUN: split-file %s %t 3 // RUN: sed -e "s@INPUT_DIR@%/t@g" %t/reference.output.json.in >> \ 4 // RUN: %t/reference.output.json 5 // RUN: %clang -extract-api -target arm64-apple-macosx \ 6 // RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s 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 // CHECK-NOT: error: 14 // CHECK-NOT: warning: 15 16 //--- input.h 17 /// Kinds of vehicles 18 enum Vehicle { 19 Bicycle, 20 Car, 21 Train, ///< Move this to the top! -Sheldon 22 Ship, 23 Airplane, 24 }; 25 26 enum Direction : unsigned char { 27 North = 0, 28 East, 29 South, 30 West 31 }; 32 33 //--- reference.output.json.in 34 { 35 "metadata": { 36 "formatVersion": { 37 "major": 0, 38 "minor": 5, 39 "patch": 3 40 }, 41 "generator": "?" 42 }, 43 "module": { 44 "name": "", 45 "platform": { 46 "architecture": "arm64", 47 "operatingSystem": { 48 "minimumVersion": { 49 "major": 11, 50 "minor": 0, 51 "patch": 0 52 }, 53 "name": "macosx" 54 }, 55 "vendor": "apple" 56 } 57 }, 58 "relationships": [ 59 { 60 "kind": "memberOf", 61 "source": "c:@E@Vehicle@Bicycle", 62 "target": "c:@E@Vehicle" 63 }, 64 { 65 "kind": "memberOf", 66 "source": "c:@E@Vehicle@Car", 67 "target": "c:@E@Vehicle" 68 }, 69 { 70 "kind": "memberOf", 71 "source": "c:@E@Vehicle@Train", 72 "target": "c:@E@Vehicle" 73 }, 74 { 75 "kind": "memberOf", 76 "source": "c:@E@Vehicle@Ship", 77 "target": "c:@E@Vehicle" 78 }, 79 { 80 "kind": "memberOf", 81 "source": "c:@E@Vehicle@Airplane", 82 "target": "c:@E@Vehicle" 83 }, 84 { 85 "kind": "memberOf", 86 "source": "c:@E@Direction@North", 87 "target": "c:@E@Direction" 88 }, 89 { 90 "kind": "memberOf", 91 "source": "c:@E@Direction@East", 92 "target": "c:@E@Direction" 93 }, 94 { 95 "kind": "memberOf", 96 "source": "c:@E@Direction@South", 97 "target": "c:@E@Direction" 98 }, 99 { 100 "kind": "memberOf", 101 "source": "c:@E@Direction@West", 102 "target": "c:@E@Direction" 103 } 104 ], 105 "symbols": [ 106 { 107 "accessLevel": "public", 108 "declarationFragments": [ 109 { 110 "kind": "keyword", 111 "spelling": "enum" 112 }, 113 { 114 "kind": "text", 115 "spelling": " " 116 }, 117 { 118 "kind": "identifier", 119 "spelling": "Vehicle" 120 }, 121 { 122 "kind": "text", 123 "spelling": ": " 124 }, 125 { 126 "kind": "typeIdentifier", 127 "preciseIdentifier": "c:i", 128 "spelling": "unsigned int" 129 } 130 ], 131 "docComment": { 132 "lines": [ 133 { 134 "range": { 135 "end": { 136 "character": 22, 137 "line": 1 138 }, 139 "start": { 140 "character": 5, 141 "line": 1 142 } 143 }, 144 "text": "Kinds of vehicles" 145 } 146 ] 147 }, 148 "identifier": { 149 "interfaceLanguage": "c", 150 "precise": "c:@E@Vehicle" 151 }, 152 "kind": { 153 "displayName": "Enumeration", 154 "identifier": "c.enum" 155 }, 156 "location": { 157 "position": { 158 "character": 6, 159 "line": 2 160 }, 161 "uri": "file://INPUT_DIR/input.h" 162 }, 163 "names": { 164 "subHeading": [ 165 { 166 "kind": "identifier", 167 "spelling": "Vehicle" 168 } 169 ], 170 "title": "Vehicle" 171 }, 172 "pathComponents": [ 173 "Vehicle" 174 ] 175 }, 176 { 177 "accessLevel": "public", 178 "declarationFragments": [ 179 { 180 "kind": "identifier", 181 "spelling": "Bicycle" 182 } 183 ], 184 "identifier": { 185 "interfaceLanguage": "c", 186 "precise": "c:@E@Vehicle@Bicycle" 187 }, 188 "kind": { 189 "displayName": "Enumeration Case", 190 "identifier": "c.enum.case" 191 }, 192 "location": { 193 "position": { 194 "character": 3, 195 "line": 3 196 }, 197 "uri": "file://INPUT_DIR/input.h" 198 }, 199 "names": { 200 "subHeading": [ 201 { 202 "kind": "identifier", 203 "spelling": "Bicycle" 204 } 205 ], 206 "title": "Bicycle" 207 }, 208 "pathComponents": [ 209 "Vehicle", 210 "Bicycle" 211 ] 212 }, 213 { 214 "accessLevel": "public", 215 "declarationFragments": [ 216 { 217 "kind": "identifier", 218 "spelling": "Car" 219 } 220 ], 221 "identifier": { 222 "interfaceLanguage": "c", 223 "precise": "c:@E@Vehicle@Car" 224 }, 225 "kind": { 226 "displayName": "Enumeration Case", 227 "identifier": "c.enum.case" 228 }, 229 "location": { 230 "position": { 231 "character": 3, 232 "line": 4 233 }, 234 "uri": "file://INPUT_DIR/input.h" 235 }, 236 "names": { 237 "subHeading": [ 238 { 239 "kind": "identifier", 240 "spelling": "Car" 241 } 242 ], 243 "title": "Car" 244 }, 245 "pathComponents": [ 246 "Vehicle", 247 "Car" 248 ] 249 }, 250 { 251 "accessLevel": "public", 252 "declarationFragments": [ 253 { 254 "kind": "identifier", 255 "spelling": "Train" 256 } 257 ], 258 "docComment": { 259 "lines": [ 260 { 261 "range": { 262 "end": { 263 "character": 45, 264 "line": 5 265 }, 266 "start": { 267 "character": 15, 268 "line": 5 269 } 270 }, 271 "text": "Move this to the top! -Sheldon" 272 } 273 ] 274 }, 275 "identifier": { 276 "interfaceLanguage": "c", 277 "precise": "c:@E@Vehicle@Train" 278 }, 279 "kind": { 280 "displayName": "Enumeration Case", 281 "identifier": "c.enum.case" 282 }, 283 "location": { 284 "position": { 285 "character": 3, 286 "line": 5 287 }, 288 "uri": "file://INPUT_DIR/input.h" 289 }, 290 "names": { 291 "subHeading": [ 292 { 293 "kind": "identifier", 294 "spelling": "Train" 295 } 296 ], 297 "title": "Train" 298 }, 299 "pathComponents": [ 300 "Vehicle", 301 "Train" 302 ] 303 }, 304 { 305 "accessLevel": "public", 306 "declarationFragments": [ 307 { 308 "kind": "identifier", 309 "spelling": "Ship" 310 } 311 ], 312 "identifier": { 313 "interfaceLanguage": "c", 314 "precise": "c:@E@Vehicle@Ship" 315 }, 316 "kind": { 317 "displayName": "Enumeration Case", 318 "identifier": "c.enum.case" 319 }, 320 "location": { 321 "position": { 322 "character": 3, 323 "line": 6 324 }, 325 "uri": "file://INPUT_DIR/input.h" 326 }, 327 "names": { 328 "subHeading": [ 329 { 330 "kind": "identifier", 331 "spelling": "Ship" 332 } 333 ], 334 "title": "Ship" 335 }, 336 "pathComponents": [ 337 "Vehicle", 338 "Ship" 339 ] 340 }, 341 { 342 "accessLevel": "public", 343 "declarationFragments": [ 344 { 345 "kind": "identifier", 346 "spelling": "Airplane" 347 } 348 ], 349 "identifier": { 350 "interfaceLanguage": "c", 351 "precise": "c:@E@Vehicle@Airplane" 352 }, 353 "kind": { 354 "displayName": "Enumeration Case", 355 "identifier": "c.enum.case" 356 }, 357 "location": { 358 "position": { 359 "character": 3, 360 "line": 7 361 }, 362 "uri": "file://INPUT_DIR/input.h" 363 }, 364 "names": { 365 "subHeading": [ 366 { 367 "kind": "identifier", 368 "spelling": "Airplane" 369 } 370 ], 371 "title": "Airplane" 372 }, 373 "pathComponents": [ 374 "Vehicle", 375 "Airplane" 376 ] 377 }, 378 { 379 "accessLevel": "public", 380 "declarationFragments": [ 381 { 382 "kind": "keyword", 383 "spelling": "enum" 384 }, 385 { 386 "kind": "text", 387 "spelling": " " 388 }, 389 { 390 "kind": "identifier", 391 "spelling": "Direction" 392 }, 393 { 394 "kind": "text", 395 "spelling": ": " 396 }, 397 { 398 "kind": "typeIdentifier", 399 "preciseIdentifier": "c:c", 400 "spelling": "unsigned char" 401 } 402 ], 403 "identifier": { 404 "interfaceLanguage": "c", 405 "precise": "c:@E@Direction" 406 }, 407 "kind": { 408 "displayName": "Enumeration", 409 "identifier": "c.enum" 410 }, 411 "location": { 412 "position": { 413 "character": 6, 414 "line": 10 415 }, 416 "uri": "file://INPUT_DIR/input.h" 417 }, 418 "names": { 419 "subHeading": [ 420 { 421 "kind": "identifier", 422 "spelling": "Direction" 423 } 424 ], 425 "title": "Direction" 426 }, 427 "pathComponents": [ 428 "Direction" 429 ] 430 }, 431 { 432 "accessLevel": "public", 433 "declarationFragments": [ 434 { 435 "kind": "identifier", 436 "spelling": "North" 437 } 438 ], 439 "identifier": { 440 "interfaceLanguage": "c", 441 "precise": "c:@E@Direction@North" 442 }, 443 "kind": { 444 "displayName": "Enumeration Case", 445 "identifier": "c.enum.case" 446 }, 447 "location": { 448 "position": { 449 "character": 3, 450 "line": 11 451 }, 452 "uri": "file://INPUT_DIR/input.h" 453 }, 454 "names": { 455 "subHeading": [ 456 { 457 "kind": "identifier", 458 "spelling": "North" 459 } 460 ], 461 "title": "North" 462 }, 463 "pathComponents": [ 464 "Direction", 465 "North" 466 ] 467 }, 468 { 469 "accessLevel": "public", 470 "declarationFragments": [ 471 { 472 "kind": "identifier", 473 "spelling": "East" 474 } 475 ], 476 "identifier": { 477 "interfaceLanguage": "c", 478 "precise": "c:@E@Direction@East" 479 }, 480 "kind": { 481 "displayName": "Enumeration Case", 482 "identifier": "c.enum.case" 483 }, 484 "location": { 485 "position": { 486 "character": 3, 487 "line": 12 488 }, 489 "uri": "file://INPUT_DIR/input.h" 490 }, 491 "names": { 492 "subHeading": [ 493 { 494 "kind": "identifier", 495 "spelling": "East" 496 } 497 ], 498 "title": "East" 499 }, 500 "pathComponents": [ 501 "Direction", 502 "East" 503 ] 504 }, 505 { 506 "accessLevel": "public", 507 "declarationFragments": [ 508 { 509 "kind": "identifier", 510 "spelling": "South" 511 } 512 ], 513 "identifier": { 514 "interfaceLanguage": "c", 515 "precise": "c:@E@Direction@South" 516 }, 517 "kind": { 518 "displayName": "Enumeration Case", 519 "identifier": "c.enum.case" 520 }, 521 "location": { 522 "position": { 523 "character": 3, 524 "line": 13 525 }, 526 "uri": "file://INPUT_DIR/input.h" 527 }, 528 "names": { 529 "subHeading": [ 530 { 531 "kind": "identifier", 532 "spelling": "South" 533 } 534 ], 535 "title": "South" 536 }, 537 "pathComponents": [ 538 "Direction", 539 "South" 540 ] 541 }, 542 { 543 "accessLevel": "public", 544 "declarationFragments": [ 545 { 546 "kind": "identifier", 547 "spelling": "West" 548 } 549 ], 550 "identifier": { 551 "interfaceLanguage": "c", 552 "precise": "c:@E@Direction@West" 553 }, 554 "kind": { 555 "displayName": "Enumeration Case", 556 "identifier": "c.enum.case" 557 }, 558 "location": { 559 "position": { 560 "character": 3, 561 "line": 14 562 }, 563 "uri": "file://INPUT_DIR/input.h" 564 }, 565 "names": { 566 "subHeading": [ 567 { 568 "kind": "identifier", 569 "spelling": "West" 570 } 571 ], 572 "title": "West" 573 }, 574 "pathComponents": [ 575 "Direction", 576 "West" 577 ] 578 } 579 ] 580 } 581