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 -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@end 23 24@interface Derived : Super { 25 char Ivar; 26} 27- (char)getIvar; 28@end 29 30//--- reference.output.json.in 31{ 32 "metadata": { 33 "formatVersion": { 34 "major": 0, 35 "minor": 5, 36 "patch": 3 37 }, 38 "generator": "?" 39 }, 40 "module": { 41 "name": "", 42 "platform": { 43 "architecture": "arm64", 44 "operatingSystem": { 45 "minimumVersion": { 46 "major": 11, 47 "minor": 0, 48 "patch": 0 49 }, 50 "name": "macosx" 51 }, 52 "vendor": "apple" 53 } 54 }, 55 "relationships": [ 56 { 57 "kind": "memberOf", 58 "source": "c:objc(cs)Super(cm)getWithProperty:", 59 "target": "c:objc(cs)Super" 60 }, 61 { 62 "kind": "memberOf", 63 "source": "c:objc(cs)Super(py)Property", 64 "target": "c:objc(cs)Super" 65 }, 66 { 67 "kind": "conformsTo", 68 "source": "c:objc(cs)Super", 69 "target": "c:objc(pl)Protocol" 70 }, 71 { 72 "kind": "memberOf", 73 "source": "c:objc(cs)Derived@Ivar", 74 "target": "c:objc(cs)Derived" 75 }, 76 { 77 "kind": "memberOf", 78 "source": "c:objc(cs)Derived(im)getIvar", 79 "target": "c:objc(cs)Derived" 80 }, 81 { 82 "kind": "inheritsFrom", 83 "source": "c:objc(cs)Derived", 84 "target": "c:objc(cs)Super" 85 } 86 ], 87 "symbols": [ 88 { 89 "accessLevel": "public", 90 "declarationFragments": [ 91 { 92 "kind": "keyword", 93 "spelling": "@interface" 94 }, 95 { 96 "kind": "text", 97 "spelling": " " 98 }, 99 { 100 "kind": "identifier", 101 "spelling": "Super" 102 } 103 ], 104 "identifier": { 105 "interfaceLanguage": "objective-c", 106 "precise": "c:objc(cs)Super" 107 }, 108 "kind": { 109 "displayName": "Class", 110 "identifier": "objective-c.class" 111 }, 112 "location": { 113 "position": { 114 "character": 12, 115 "line": 3 116 }, 117 "uri": "file://INPUT_DIR/input.h" 118 }, 119 "names": { 120 "subHeading": [ 121 { 122 "kind": "identifier", 123 "spelling": "Super" 124 } 125 ], 126 "title": "Super" 127 }, 128 "pathComponents": [ 129 "Super" 130 ] 131 }, 132 { 133 "accessLevel": "public", 134 "declarationFragments": [ 135 { 136 "kind": "text", 137 "spelling": "+ (" 138 }, 139 { 140 "kind": "keyword", 141 "spelling": "id" 142 }, 143 { 144 "kind": "text", 145 "spelling": ")" 146 }, 147 { 148 "kind": "identifier", 149 "spelling": "getWithProperty" 150 }, 151 { 152 "kind": "text", 153 "spelling": ":" 154 }, 155 { 156 "kind": "text", 157 "spelling": "(" 158 }, 159 { 160 "kind": "typeIdentifier", 161 "preciseIdentifier": "c:i", 162 "spelling": "unsigned int" 163 }, 164 { 165 "kind": "text", 166 "spelling": ")" 167 }, 168 { 169 "kind": "internalParam", 170 "spelling": "Property" 171 } 172 ], 173 "identifier": { 174 "interfaceLanguage": "objective-c", 175 "precise": "c:objc(cs)Super(cm)getWithProperty:" 176 }, 177 "kind": { 178 "displayName": "Type Method", 179 "identifier": "objective-c.type.method" 180 }, 181 "location": { 182 "position": { 183 "character": 1, 184 "line": 5 185 }, 186 "uri": "file://INPUT_DIR/input.h" 187 }, 188 "names": { 189 "subHeading": [ 190 { 191 "kind": "text", 192 "spelling": "+ " 193 }, 194 { 195 "kind": "identifier", 196 "spelling": "getWithProperty:" 197 } 198 ], 199 "title": "getWithProperty:" 200 }, 201 "pathComponents": [ 202 "Super", 203 "getWithProperty:" 204 ] 205 }, 206 { 207 "accessLevel": "public", 208 "declarationFragments": [ 209 { 210 "kind": "keyword", 211 "spelling": "@property" 212 }, 213 { 214 "kind": "text", 215 "spelling": " (" 216 }, 217 { 218 "kind": "keyword", 219 "spelling": "atomic" 220 }, 221 { 222 "kind": "text", 223 "spelling": ", " 224 }, 225 { 226 "kind": "keyword", 227 "spelling": "readonly" 228 }, 229 { 230 "kind": "text", 231 "spelling": ", " 232 }, 233 { 234 "kind": "keyword", 235 "spelling": "getter" 236 }, 237 { 238 "kind": "text", 239 "spelling": "=" 240 }, 241 { 242 "kind": "identifier", 243 "spelling": "getProperty" 244 }, 245 { 246 "kind": "text", 247 "spelling": ")" 248 }, 249 { 250 "kind": "typeIdentifier", 251 "preciseIdentifier": "c:i", 252 "spelling": "unsigned int" 253 }, 254 { 255 "kind": "identifier", 256 "spelling": "Property" 257 } 258 ], 259 "identifier": { 260 "interfaceLanguage": "objective-c", 261 "precise": "c:objc(cs)Super(py)Property" 262 }, 263 "kind": { 264 "displayName": "Instance Property", 265 "identifier": "objective-c.property" 266 }, 267 "location": { 268 "position": { 269 "character": 50, 270 "line": 4 271 }, 272 "uri": "file://INPUT_DIR/input.h" 273 }, 274 "names": { 275 "subHeading": [ 276 { 277 "kind": "identifier", 278 "spelling": "Property" 279 } 280 ], 281 "title": "Property" 282 }, 283 "pathComponents": [ 284 "Super", 285 "Property" 286 ] 287 }, 288 { 289 "accessLevel": "public", 290 "declarationFragments": [ 291 { 292 "kind": "keyword", 293 "spelling": "@interface" 294 }, 295 { 296 "kind": "text", 297 "spelling": " " 298 }, 299 { 300 "kind": "identifier", 301 "spelling": "Derived" 302 }, 303 { 304 "kind": "text", 305 "spelling": " : " 306 }, 307 { 308 "kind": "typeIdentifier", 309 "preciseIdentifier": "c:objc(cs)Super", 310 "spelling": "Super" 311 } 312 ], 313 "identifier": { 314 "interfaceLanguage": "objective-c", 315 "precise": "c:objc(cs)Derived" 316 }, 317 "kind": { 318 "displayName": "Class", 319 "identifier": "objective-c.class" 320 }, 321 "location": { 322 "position": { 323 "character": 12, 324 "line": 8 325 }, 326 "uri": "file://INPUT_DIR/input.h" 327 }, 328 "names": { 329 "subHeading": [ 330 { 331 "kind": "identifier", 332 "spelling": "Derived" 333 } 334 ], 335 "title": "Derived" 336 }, 337 "pathComponents": [ 338 "Derived" 339 ] 340 }, 341 { 342 "accessLevel": "public", 343 "declarationFragments": [ 344 { 345 "kind": "typeIdentifier", 346 "preciseIdentifier": "c:C", 347 "spelling": "char" 348 }, 349 { 350 "kind": "text", 351 "spelling": " " 352 }, 353 { 354 "kind": "identifier", 355 "spelling": "Ivar" 356 } 357 ], 358 "identifier": { 359 "interfaceLanguage": "objective-c", 360 "precise": "c:objc(cs)Derived@Ivar" 361 }, 362 "kind": { 363 "displayName": "Instance Variable", 364 "identifier": "objective-c.ivar" 365 }, 366 "location": { 367 "position": { 368 "character": 8, 369 "line": 9 370 }, 371 "uri": "file://INPUT_DIR/input.h" 372 }, 373 "names": { 374 "subHeading": [ 375 { 376 "kind": "identifier", 377 "spelling": "Ivar" 378 } 379 ], 380 "title": "Ivar" 381 }, 382 "pathComponents": [ 383 "Derived", 384 "Ivar" 385 ] 386 }, 387 { 388 "accessLevel": "public", 389 "declarationFragments": [ 390 { 391 "kind": "text", 392 "spelling": "- (" 393 }, 394 { 395 "kind": "typeIdentifier", 396 "preciseIdentifier": "c:C", 397 "spelling": "char" 398 }, 399 { 400 "kind": "text", 401 "spelling": ")" 402 }, 403 { 404 "kind": "identifier", 405 "spelling": "getIvar" 406 } 407 ], 408 "identifier": { 409 "interfaceLanguage": "objective-c", 410 "precise": "c:objc(cs)Derived(im)getIvar" 411 }, 412 "kind": { 413 "displayName": "Instance Method", 414 "identifier": "objective-c.method" 415 }, 416 "location": { 417 "position": { 418 "character": 1, 419 "line": 11 420 }, 421 "uri": "file://INPUT_DIR/input.h" 422 }, 423 "names": { 424 "subHeading": [ 425 { 426 "kind": "text", 427 "spelling": "- " 428 }, 429 { 430 "kind": "identifier", 431 "spelling": "getIvar" 432 } 433 ], 434 "title": "getIvar" 435 }, 436 "pathComponents": [ 437 "Derived", 438 "getIvar" 439 ] 440 } 441 ] 442} 443