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 "relationhips": [ 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 "declarationFragments": [ 108 { 109 "kind": "keyword", 110 "spelling": "enum" 111 }, 112 { 113 "kind": "text", 114 "spelling": " " 115 }, 116 { 117 "kind": "identifier", 118 "spelling": "Vehicle" 119 }, 120 { 121 "kind": "text", 122 "spelling": ": " 123 }, 124 { 125 "kind": "typeIdentifier", 126 "preciseIdentifier": "c:i", 127 "spelling": "unsigned int" 128 } 129 ], 130 "docComment": { 131 "lines": [ 132 { 133 "range": { 134 "end": { 135 "character": 22, 136 "line": 1 137 }, 138 "start": { 139 "character": 5, 140 "line": 1 141 } 142 }, 143 "text": "Kinds of vehicles" 144 } 145 ] 146 }, 147 "identifier": { 148 "interfaceLanguage": "c", 149 "precise": "c:@E@Vehicle" 150 }, 151 "kind": { 152 "displayName": "Enumeration", 153 "identifier": "c.enum" 154 }, 155 "location": { 156 "character": 6, 157 "line": 2, 158 "uri": "file://INPUT_DIR/input.h" 159 }, 160 "names": { 161 "subHeading": [ 162 { 163 "kind": "identifier", 164 "spelling": "Vehicle" 165 } 166 ], 167 "title": "Vehicle" 168 } 169 }, 170 { 171 "declarationFragments": [ 172 { 173 "kind": "identifier", 174 "spelling": "Bicycle" 175 } 176 ], 177 "identifier": { 178 "interfaceLanguage": "c", 179 "precise": "c:@E@Vehicle@Bicycle" 180 }, 181 "kind": { 182 "displayName": "Enumeration Case", 183 "identifier": "c.enum.case" 184 }, 185 "location": { 186 "character": 3, 187 "line": 3, 188 "uri": "file://INPUT_DIR/input.h" 189 }, 190 "names": { 191 "subHeading": [ 192 { 193 "kind": "identifier", 194 "spelling": "Bicycle" 195 } 196 ], 197 "title": "Bicycle" 198 } 199 }, 200 { 201 "declarationFragments": [ 202 { 203 "kind": "identifier", 204 "spelling": "Car" 205 } 206 ], 207 "identifier": { 208 "interfaceLanguage": "c", 209 "precise": "c:@E@Vehicle@Car" 210 }, 211 "kind": { 212 "displayName": "Enumeration Case", 213 "identifier": "c.enum.case" 214 }, 215 "location": { 216 "character": 3, 217 "line": 4, 218 "uri": "file://INPUT_DIR/input.h" 219 }, 220 "names": { 221 "subHeading": [ 222 { 223 "kind": "identifier", 224 "spelling": "Car" 225 } 226 ], 227 "title": "Car" 228 } 229 }, 230 { 231 "declarationFragments": [ 232 { 233 "kind": "identifier", 234 "spelling": "Train" 235 } 236 ], 237 "docComment": { 238 "lines": [ 239 { 240 "range": { 241 "end": { 242 "character": 45, 243 "line": 5 244 }, 245 "start": { 246 "character": 15, 247 "line": 5 248 } 249 }, 250 "text": "Move this to the top! -Sheldon" 251 } 252 ] 253 }, 254 "identifier": { 255 "interfaceLanguage": "c", 256 "precise": "c:@E@Vehicle@Train" 257 }, 258 "kind": { 259 "displayName": "Enumeration Case", 260 "identifier": "c.enum.case" 261 }, 262 "location": { 263 "character": 3, 264 "line": 5, 265 "uri": "file://INPUT_DIR/input.h" 266 }, 267 "names": { 268 "subHeading": [ 269 { 270 "kind": "identifier", 271 "spelling": "Train" 272 } 273 ], 274 "title": "Train" 275 } 276 }, 277 { 278 "declarationFragments": [ 279 { 280 "kind": "identifier", 281 "spelling": "Ship" 282 } 283 ], 284 "identifier": { 285 "interfaceLanguage": "c", 286 "precise": "c:@E@Vehicle@Ship" 287 }, 288 "kind": { 289 "displayName": "Enumeration Case", 290 "identifier": "c.enum.case" 291 }, 292 "location": { 293 "character": 3, 294 "line": 6, 295 "uri": "file://INPUT_DIR/input.h" 296 }, 297 "names": { 298 "subHeading": [ 299 { 300 "kind": "identifier", 301 "spelling": "Ship" 302 } 303 ], 304 "title": "Ship" 305 } 306 }, 307 { 308 "declarationFragments": [ 309 { 310 "kind": "identifier", 311 "spelling": "Airplane" 312 } 313 ], 314 "identifier": { 315 "interfaceLanguage": "c", 316 "precise": "c:@E@Vehicle@Airplane" 317 }, 318 "kind": { 319 "displayName": "Enumeration Case", 320 "identifier": "c.enum.case" 321 }, 322 "location": { 323 "character": 3, 324 "line": 7, 325 "uri": "file://INPUT_DIR/input.h" 326 }, 327 "names": { 328 "subHeading": [ 329 { 330 "kind": "identifier", 331 "spelling": "Airplane" 332 } 333 ], 334 "title": "Airplane" 335 } 336 }, 337 { 338 "declarationFragments": [ 339 { 340 "kind": "keyword", 341 "spelling": "enum" 342 }, 343 { 344 "kind": "text", 345 "spelling": " " 346 }, 347 { 348 "kind": "identifier", 349 "spelling": "Direction" 350 }, 351 { 352 "kind": "text", 353 "spelling": ": " 354 }, 355 { 356 "kind": "typeIdentifier", 357 "preciseIdentifier": "c:c", 358 "spelling": "unsigned char" 359 } 360 ], 361 "identifier": { 362 "interfaceLanguage": "c", 363 "precise": "c:@E@Direction" 364 }, 365 "kind": { 366 "displayName": "Enumeration", 367 "identifier": "c.enum" 368 }, 369 "location": { 370 "character": 6, 371 "line": 10, 372 "uri": "file://INPUT_DIR/input.h" 373 }, 374 "names": { 375 "subHeading": [ 376 { 377 "kind": "identifier", 378 "spelling": "Direction" 379 } 380 ], 381 "title": "Direction" 382 } 383 }, 384 { 385 "declarationFragments": [ 386 { 387 "kind": "identifier", 388 "spelling": "North" 389 } 390 ], 391 "identifier": { 392 "interfaceLanguage": "c", 393 "precise": "c:@E@Direction@North" 394 }, 395 "kind": { 396 "displayName": "Enumeration Case", 397 "identifier": "c.enum.case" 398 }, 399 "location": { 400 "character": 3, 401 "line": 11, 402 "uri": "file://INPUT_DIR/input.h" 403 }, 404 "names": { 405 "subHeading": [ 406 { 407 "kind": "identifier", 408 "spelling": "North" 409 } 410 ], 411 "title": "North" 412 } 413 }, 414 { 415 "declarationFragments": [ 416 { 417 "kind": "identifier", 418 "spelling": "East" 419 } 420 ], 421 "identifier": { 422 "interfaceLanguage": "c", 423 "precise": "c:@E@Direction@East" 424 }, 425 "kind": { 426 "displayName": "Enumeration Case", 427 "identifier": "c.enum.case" 428 }, 429 "location": { 430 "character": 3, 431 "line": 12, 432 "uri": "file://INPUT_DIR/input.h" 433 }, 434 "names": { 435 "subHeading": [ 436 { 437 "kind": "identifier", 438 "spelling": "East" 439 } 440 ], 441 "title": "East" 442 } 443 }, 444 { 445 "declarationFragments": [ 446 { 447 "kind": "identifier", 448 "spelling": "South" 449 } 450 ], 451 "identifier": { 452 "interfaceLanguage": "c", 453 "precise": "c:@E@Direction@South" 454 }, 455 "kind": { 456 "displayName": "Enumeration Case", 457 "identifier": "c.enum.case" 458 }, 459 "location": { 460 "character": 3, 461 "line": 13, 462 "uri": "file://INPUT_DIR/input.h" 463 }, 464 "names": { 465 "subHeading": [ 466 { 467 "kind": "identifier", 468 "spelling": "South" 469 } 470 ], 471 "title": "South" 472 } 473 }, 474 { 475 "declarationFragments": [ 476 { 477 "kind": "identifier", 478 "spelling": "West" 479 } 480 ], 481 "identifier": { 482 "interfaceLanguage": "c", 483 "precise": "c:@E@Direction@West" 484 }, 485 "kind": { 486 "displayName": "Enumeration Case", 487 "identifier": "c.enum.case" 488 }, 489 "location": { 490 "character": 3, 491 "line": 14, 492 "uri": "file://INPUT_DIR/input.h" 493 }, 494 "names": { 495 "subHeading": [ 496 { 497 "kind": "identifier", 498 "spelling": "West" 499 } 500 ], 501 "title": "West" 502 } 503 } 504 ] 505 } 506