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 -x objective-c-header -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@protocol Protocol; 18 19@interface Super <Protocol> 20@property(readonly, getter=getProperty) unsigned Property; 21+ (id)getWithProperty:(unsigned) Property; 22- (void)setProperty:(unsigned) Property andOtherThing: (unsigned) Thing; 23@end 24 25@interface Derived : Super { 26 char Ivar; 27} 28- (char)getIvar; 29@end 30 31//--- reference.output.json.in 32{ 33 "metadata": { 34 "formatVersion": { 35 "major": 0, 36 "minor": 5, 37 "patch": 3 38 }, 39 "generator": "?" 40 }, 41 "module": { 42 "name": "", 43 "platform": { 44 "architecture": "arm64", 45 "operatingSystem": { 46 "minimumVersion": { 47 "major": 11, 48 "minor": 0, 49 "patch": 0 50 }, 51 "name": "macosx" 52 }, 53 "vendor": "apple" 54 } 55 }, 56 "relationships": [ 57 { 58 "kind": "memberOf", 59 "source": "c:objc(cs)Super(cm)getWithProperty:", 60 "target": "c:objc(cs)Super" 61 }, 62 { 63 "kind": "memberOf", 64 "source": "c:objc(cs)Super(im)setProperty:andOtherThing:", 65 "target": "c:objc(cs)Super" 66 }, 67 { 68 "kind": "memberOf", 69 "source": "c:objc(cs)Super(py)Property", 70 "target": "c:objc(cs)Super" 71 }, 72 { 73 "kind": "conformsTo", 74 "source": "c:objc(cs)Super", 75 "target": "c:objc(pl)Protocol" 76 }, 77 { 78 "kind": "memberOf", 79 "source": "c:objc(cs)Derived@Ivar", 80 "target": "c:objc(cs)Derived" 81 }, 82 { 83 "kind": "memberOf", 84 "source": "c:objc(cs)Derived(im)getIvar", 85 "target": "c:objc(cs)Derived" 86 }, 87 { 88 "kind": "inheritsFrom", 89 "source": "c:objc(cs)Derived", 90 "target": "c:objc(cs)Super" 91 } 92 ], 93 "symbols": [ 94 { 95 "accessLevel": "public", 96 "declarationFragments": [ 97 { 98 "kind": "keyword", 99 "spelling": "@interface" 100 }, 101 { 102 "kind": "text", 103 "spelling": " " 104 }, 105 { 106 "kind": "identifier", 107 "spelling": "Super" 108 } 109 ], 110 "identifier": { 111 "interfaceLanguage": "objective-c", 112 "precise": "c:objc(cs)Super" 113 }, 114 "kind": { 115 "displayName": "Class", 116 "identifier": "objective-c.class" 117 }, 118 "location": { 119 "position": { 120 "character": 12, 121 "line": 3 122 }, 123 "uri": "file://INPUT_DIR/input.h" 124 }, 125 "names": { 126 "navigator": [ 127 { 128 "kind": "identifier", 129 "spelling": "Super" 130 } 131 ], 132 "subHeading": [ 133 { 134 "kind": "identifier", 135 "spelling": "Super" 136 } 137 ], 138 "title": "Super" 139 }, 140 "pathComponents": [ 141 "Super" 142 ] 143 }, 144 { 145 "accessLevel": "public", 146 "declarationFragments": [ 147 { 148 "kind": "text", 149 "spelling": "+ (" 150 }, 151 { 152 "kind": "keyword", 153 "spelling": "id" 154 }, 155 { 156 "kind": "text", 157 "spelling": ") " 158 }, 159 { 160 "kind": "identifier", 161 "spelling": "getWithProperty:" 162 }, 163 { 164 "kind": "text", 165 "spelling": "(" 166 }, 167 { 168 "kind": "typeIdentifier", 169 "preciseIdentifier": "c:i", 170 "spelling": "unsigned int" 171 }, 172 { 173 "kind": "text", 174 "spelling": ") " 175 }, 176 { 177 "kind": "internalParam", 178 "spelling": "Property" 179 }, 180 { 181 "kind": "text", 182 "spelling": ";" 183 } 184 ], 185 "functionSignature": { 186 "parameters": [ 187 { 188 "declarationFragments": [ 189 { 190 "kind": "text", 191 "spelling": "(" 192 }, 193 { 194 "kind": "typeIdentifier", 195 "preciseIdentifier": "c:i", 196 "spelling": "unsigned int" 197 }, 198 { 199 "kind": "text", 200 "spelling": ") " 201 }, 202 { 203 "kind": "internalParam", 204 "spelling": "Property" 205 } 206 ], 207 "name": "Property" 208 } 209 ], 210 "returns": [ 211 { 212 "kind": "keyword", 213 "spelling": "id" 214 } 215 ] 216 }, 217 "identifier": { 218 "interfaceLanguage": "objective-c", 219 "precise": "c:objc(cs)Super(cm)getWithProperty:" 220 }, 221 "kind": { 222 "displayName": "Type Method", 223 "identifier": "objective-c.type.method" 224 }, 225 "location": { 226 "position": { 227 "character": 1, 228 "line": 5 229 }, 230 "uri": "file://INPUT_DIR/input.h" 231 }, 232 "names": { 233 "navigator": [ 234 { 235 "kind": "identifier", 236 "spelling": "getWithProperty:" 237 } 238 ], 239 "subHeading": [ 240 { 241 "kind": "text", 242 "spelling": "+ " 243 }, 244 { 245 "kind": "identifier", 246 "spelling": "getWithProperty:" 247 } 248 ], 249 "title": "getWithProperty:" 250 }, 251 "pathComponents": [ 252 "Super", 253 "getWithProperty:" 254 ] 255 }, 256 { 257 "accessLevel": "public", 258 "declarationFragments": [ 259 { 260 "kind": "text", 261 "spelling": "- (" 262 }, 263 { 264 "kind": "typeIdentifier", 265 "preciseIdentifier": "c:v", 266 "spelling": "void" 267 }, 268 { 269 "kind": "text", 270 "spelling": ") " 271 }, 272 { 273 "kind": "identifier", 274 "spelling": "setProperty:" 275 }, 276 { 277 "kind": "text", 278 "spelling": "(" 279 }, 280 { 281 "kind": "typeIdentifier", 282 "preciseIdentifier": "c:i", 283 "spelling": "unsigned int" 284 }, 285 { 286 "kind": "text", 287 "spelling": ") " 288 }, 289 { 290 "kind": "internalParam", 291 "spelling": "Property" 292 }, 293 { 294 "kind": "text", 295 "spelling": " " 296 }, 297 { 298 "kind": "identifier", 299 "spelling": "andOtherThing:" 300 }, 301 { 302 "kind": "text", 303 "spelling": "(" 304 }, 305 { 306 "kind": "typeIdentifier", 307 "preciseIdentifier": "c:i", 308 "spelling": "unsigned int" 309 }, 310 { 311 "kind": "text", 312 "spelling": ") " 313 }, 314 { 315 "kind": "internalParam", 316 "spelling": "Thing" 317 }, 318 { 319 "kind": "text", 320 "spelling": ";" 321 } 322 ], 323 "functionSignature": { 324 "parameters": [ 325 { 326 "declarationFragments": [ 327 { 328 "kind": "text", 329 "spelling": "(" 330 }, 331 { 332 "kind": "typeIdentifier", 333 "preciseIdentifier": "c:i", 334 "spelling": "unsigned int" 335 }, 336 { 337 "kind": "text", 338 "spelling": ") " 339 }, 340 { 341 "kind": "internalParam", 342 "spelling": "Property" 343 } 344 ], 345 "name": "Property" 346 }, 347 { 348 "declarationFragments": [ 349 { 350 "kind": "text", 351 "spelling": "(" 352 }, 353 { 354 "kind": "typeIdentifier", 355 "preciseIdentifier": "c:i", 356 "spelling": "unsigned int" 357 }, 358 { 359 "kind": "text", 360 "spelling": ") " 361 }, 362 { 363 "kind": "internalParam", 364 "spelling": "Thing" 365 } 366 ], 367 "name": "Thing" 368 } 369 ], 370 "returns": [ 371 { 372 "kind": "typeIdentifier", 373 "preciseIdentifier": "c:v", 374 "spelling": "void" 375 } 376 ] 377 }, 378 "identifier": { 379 "interfaceLanguage": "objective-c", 380 "precise": "c:objc(cs)Super(im)setProperty:andOtherThing:" 381 }, 382 "kind": { 383 "displayName": "Instance Method", 384 "identifier": "objective-c.method" 385 }, 386 "location": { 387 "position": { 388 "character": 1, 389 "line": 6 390 }, 391 "uri": "file://INPUT_DIR/input.h" 392 }, 393 "names": { 394 "navigator": [ 395 { 396 "kind": "identifier", 397 "spelling": "setProperty:andOtherThing:" 398 } 399 ], 400 "subHeading": [ 401 { 402 "kind": "text", 403 "spelling": "- " 404 }, 405 { 406 "kind": "identifier", 407 "spelling": "setProperty:andOtherThing:" 408 } 409 ], 410 "title": "setProperty:andOtherThing:" 411 }, 412 "pathComponents": [ 413 "Super", 414 "setProperty:andOtherThing:" 415 ] 416 }, 417 { 418 "accessLevel": "public", 419 "declarationFragments": [ 420 { 421 "kind": "keyword", 422 "spelling": "@property" 423 }, 424 { 425 "kind": "text", 426 "spelling": " (" 427 }, 428 { 429 "kind": "keyword", 430 "spelling": "atomic" 431 }, 432 { 433 "kind": "text", 434 "spelling": ", " 435 }, 436 { 437 "kind": "keyword", 438 "spelling": "readonly" 439 }, 440 { 441 "kind": "text", 442 "spelling": ", " 443 }, 444 { 445 "kind": "keyword", 446 "spelling": "getter" 447 }, 448 { 449 "kind": "text", 450 "spelling": "=" 451 }, 452 { 453 "kind": "identifier", 454 "spelling": "getProperty" 455 }, 456 { 457 "kind": "text", 458 "spelling": ") " 459 }, 460 { 461 "kind": "typeIdentifier", 462 "preciseIdentifier": "c:i", 463 "spelling": "unsigned int" 464 }, 465 { 466 "kind": "identifier", 467 "spelling": "Property" 468 } 469 ], 470 "identifier": { 471 "interfaceLanguage": "objective-c", 472 "precise": "c:objc(cs)Super(py)Property" 473 }, 474 "kind": { 475 "displayName": "Instance Property", 476 "identifier": "objective-c.property" 477 }, 478 "location": { 479 "position": { 480 "character": 50, 481 "line": 4 482 }, 483 "uri": "file://INPUT_DIR/input.h" 484 }, 485 "names": { 486 "navigator": [ 487 { 488 "kind": "identifier", 489 "spelling": "Property" 490 } 491 ], 492 "subHeading": [ 493 { 494 "kind": "identifier", 495 "spelling": "Property" 496 } 497 ], 498 "title": "Property" 499 }, 500 "pathComponents": [ 501 "Super", 502 "Property" 503 ] 504 }, 505 { 506 "accessLevel": "public", 507 "declarationFragments": [ 508 { 509 "kind": "keyword", 510 "spelling": "@interface" 511 }, 512 { 513 "kind": "text", 514 "spelling": " " 515 }, 516 { 517 "kind": "identifier", 518 "spelling": "Derived" 519 }, 520 { 521 "kind": "text", 522 "spelling": " : " 523 }, 524 { 525 "kind": "typeIdentifier", 526 "preciseIdentifier": "c:objc(cs)Super", 527 "spelling": "Super" 528 } 529 ], 530 "identifier": { 531 "interfaceLanguage": "objective-c", 532 "precise": "c:objc(cs)Derived" 533 }, 534 "kind": { 535 "displayName": "Class", 536 "identifier": "objective-c.class" 537 }, 538 "location": { 539 "position": { 540 "character": 12, 541 "line": 9 542 }, 543 "uri": "file://INPUT_DIR/input.h" 544 }, 545 "names": { 546 "navigator": [ 547 { 548 "kind": "identifier", 549 "spelling": "Derived" 550 } 551 ], 552 "subHeading": [ 553 { 554 "kind": "identifier", 555 "spelling": "Derived" 556 } 557 ], 558 "title": "Derived" 559 }, 560 "pathComponents": [ 561 "Derived" 562 ] 563 }, 564 { 565 "accessLevel": "public", 566 "declarationFragments": [ 567 { 568 "kind": "typeIdentifier", 569 "preciseIdentifier": "c:C", 570 "spelling": "char" 571 }, 572 { 573 "kind": "text", 574 "spelling": " " 575 }, 576 { 577 "kind": "identifier", 578 "spelling": "Ivar" 579 } 580 ], 581 "identifier": { 582 "interfaceLanguage": "objective-c", 583 "precise": "c:objc(cs)Derived@Ivar" 584 }, 585 "kind": { 586 "displayName": "Instance Variable", 587 "identifier": "objective-c.ivar" 588 }, 589 "location": { 590 "position": { 591 "character": 8, 592 "line": 10 593 }, 594 "uri": "file://INPUT_DIR/input.h" 595 }, 596 "names": { 597 "navigator": [ 598 { 599 "kind": "identifier", 600 "spelling": "Ivar" 601 } 602 ], 603 "subHeading": [ 604 { 605 "kind": "identifier", 606 "spelling": "Ivar" 607 } 608 ], 609 "title": "Ivar" 610 }, 611 "pathComponents": [ 612 "Derived", 613 "Ivar" 614 ] 615 }, 616 { 617 "accessLevel": "public", 618 "declarationFragments": [ 619 { 620 "kind": "text", 621 "spelling": "- (" 622 }, 623 { 624 "kind": "typeIdentifier", 625 "preciseIdentifier": "c:C", 626 "spelling": "char" 627 }, 628 { 629 "kind": "text", 630 "spelling": ") " 631 }, 632 { 633 "kind": "identifier", 634 "spelling": "getIvar" 635 }, 636 { 637 "kind": "text", 638 "spelling": ";" 639 } 640 ], 641 "functionSignature": { 642 "returns": [ 643 { 644 "kind": "typeIdentifier", 645 "preciseIdentifier": "c:C", 646 "spelling": "char" 647 } 648 ] 649 }, 650 "identifier": { 651 "interfaceLanguage": "objective-c", 652 "precise": "c:objc(cs)Derived(im)getIvar" 653 }, 654 "kind": { 655 "displayName": "Instance Method", 656 "identifier": "objective-c.method" 657 }, 658 "location": { 659 "position": { 660 "character": 1, 661 "line": 12 662 }, 663 "uri": "file://INPUT_DIR/input.h" 664 }, 665 "names": { 666 "navigator": [ 667 { 668 "kind": "identifier", 669 "spelling": "getIvar" 670 } 671 ], 672 "subHeading": [ 673 { 674 "kind": "text", 675 "spelling": "- " 676 }, 677 { 678 "kind": "identifier", 679 "spelling": "getIvar" 680 } 681 ], 682 "title": "getIvar" 683 }, 684 "pathComponents": [ 685 "Derived", 686 "getIvar" 687 ] 688 } 689 ] 690} 691