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 -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 /// Color in RGBA 18 struct Color { 19 unsigned Red; 20 unsigned Green; 21 unsigned Blue; 22 /// Alpha channel for transparency 23 unsigned Alpha; 24 }; 25 26 //--- reference.output.json.in 27 { 28 "metadata": { 29 "formatVersion": { 30 "major": 0, 31 "minor": 5, 32 "patch": 3 33 }, 34 "generator": "?" 35 }, 36 "module": { 37 "name": "", 38 "platform": { 39 "architecture": "arm64", 40 "operatingSystem": { 41 "minimumVersion": { 42 "major": 11, 43 "minor": 0, 44 "patch": 0 45 }, 46 "name": "macosx" 47 }, 48 "vendor": "apple" 49 } 50 }, 51 "relationships": [ 52 { 53 "kind": "memberOf", 54 "source": "c:@S@Color@FI@Red", 55 "target": "c:@S@Color", 56 "targetFallback": "Color" 57 }, 58 { 59 "kind": "memberOf", 60 "source": "c:@S@Color@FI@Green", 61 "target": "c:@S@Color", 62 "targetFallback": "Color" 63 }, 64 { 65 "kind": "memberOf", 66 "source": "c:@S@Color@FI@Blue", 67 "target": "c:@S@Color", 68 "targetFallback": "Color" 69 }, 70 { 71 "kind": "memberOf", 72 "source": "c:@S@Color@FI@Alpha", 73 "target": "c:@S@Color", 74 "targetFallback": "Color" 75 } 76 ], 77 "symbols": [ 78 { 79 "accessLevel": "public", 80 "declarationFragments": [ 81 { 82 "kind": "keyword", 83 "spelling": "struct" 84 }, 85 { 86 "kind": "text", 87 "spelling": " " 88 }, 89 { 90 "kind": "identifier", 91 "spelling": "Color" 92 }, 93 { 94 "kind": "text", 95 "spelling": ";" 96 } 97 ], 98 "docComment": { 99 "lines": [ 100 { 101 "range": { 102 "end": { 103 "character": 18, 104 "line": 1 105 }, 106 "start": { 107 "character": 5, 108 "line": 1 109 } 110 }, 111 "text": "Color in RGBA" 112 } 113 ] 114 }, 115 "identifier": { 116 "interfaceLanguage": "c", 117 "precise": "c:@S@Color" 118 }, 119 "kind": { 120 "displayName": "Structure", 121 "identifier": "c.struct" 122 }, 123 "location": { 124 "position": { 125 "character": 8, 126 "line": 2 127 }, 128 "uri": "file://INPUT_DIR/input.h" 129 }, 130 "names": { 131 "navigator": [ 132 { 133 "kind": "identifier", 134 "spelling": "Color" 135 } 136 ], 137 "subHeading": [ 138 { 139 "kind": "identifier", 140 "spelling": "Color" 141 } 142 ], 143 "title": "Color" 144 }, 145 "pathComponents": [ 146 "Color" 147 ] 148 }, 149 { 150 "accessLevel": "public", 151 "declarationFragments": [ 152 { 153 "kind": "typeIdentifier", 154 "preciseIdentifier": "c:i", 155 "spelling": "unsigned int" 156 }, 157 { 158 "kind": "text", 159 "spelling": " " 160 }, 161 { 162 "kind": "identifier", 163 "spelling": "Red" 164 } 165 ], 166 "identifier": { 167 "interfaceLanguage": "c", 168 "precise": "c:@S@Color@FI@Red" 169 }, 170 "kind": { 171 "displayName": "Instance Property", 172 "identifier": "c.property" 173 }, 174 "location": { 175 "position": { 176 "character": 12, 177 "line": 3 178 }, 179 "uri": "file://INPUT_DIR/input.h" 180 }, 181 "names": { 182 "navigator": [ 183 { 184 "kind": "identifier", 185 "spelling": "Red" 186 } 187 ], 188 "subHeading": [ 189 { 190 "kind": "identifier", 191 "spelling": "Red" 192 } 193 ], 194 "title": "Red" 195 }, 196 "pathComponents": [ 197 "Color", 198 "Red" 199 ] 200 }, 201 { 202 "accessLevel": "public", 203 "declarationFragments": [ 204 { 205 "kind": "typeIdentifier", 206 "preciseIdentifier": "c:i", 207 "spelling": "unsigned int" 208 }, 209 { 210 "kind": "text", 211 "spelling": " " 212 }, 213 { 214 "kind": "identifier", 215 "spelling": "Green" 216 } 217 ], 218 "identifier": { 219 "interfaceLanguage": "c", 220 "precise": "c:@S@Color@FI@Green" 221 }, 222 "kind": { 223 "displayName": "Instance Property", 224 "identifier": "c.property" 225 }, 226 "location": { 227 "position": { 228 "character": 12, 229 "line": 4 230 }, 231 "uri": "file://INPUT_DIR/input.h" 232 }, 233 "names": { 234 "navigator": [ 235 { 236 "kind": "identifier", 237 "spelling": "Green" 238 } 239 ], 240 "subHeading": [ 241 { 242 "kind": "identifier", 243 "spelling": "Green" 244 } 245 ], 246 "title": "Green" 247 }, 248 "pathComponents": [ 249 "Color", 250 "Green" 251 ] 252 }, 253 { 254 "accessLevel": "public", 255 "declarationFragments": [ 256 { 257 "kind": "typeIdentifier", 258 "preciseIdentifier": "c:i", 259 "spelling": "unsigned int" 260 }, 261 { 262 "kind": "text", 263 "spelling": " " 264 }, 265 { 266 "kind": "identifier", 267 "spelling": "Blue" 268 } 269 ], 270 "identifier": { 271 "interfaceLanguage": "c", 272 "precise": "c:@S@Color@FI@Blue" 273 }, 274 "kind": { 275 "displayName": "Instance Property", 276 "identifier": "c.property" 277 }, 278 "location": { 279 "position": { 280 "character": 12, 281 "line": 5 282 }, 283 "uri": "file://INPUT_DIR/input.h" 284 }, 285 "names": { 286 "navigator": [ 287 { 288 "kind": "identifier", 289 "spelling": "Blue" 290 } 291 ], 292 "subHeading": [ 293 { 294 "kind": "identifier", 295 "spelling": "Blue" 296 } 297 ], 298 "title": "Blue" 299 }, 300 "pathComponents": [ 301 "Color", 302 "Blue" 303 ] 304 }, 305 { 306 "accessLevel": "public", 307 "declarationFragments": [ 308 { 309 "kind": "typeIdentifier", 310 "preciseIdentifier": "c:i", 311 "spelling": "unsigned int" 312 }, 313 { 314 "kind": "text", 315 "spelling": " " 316 }, 317 { 318 "kind": "identifier", 319 "spelling": "Alpha" 320 } 321 ], 322 "docComment": { 323 "lines": [ 324 { 325 "range": { 326 "end": { 327 "character": 37, 328 "line": 6 329 }, 330 "start": { 331 "character": 7, 332 "line": 6 333 } 334 }, 335 "text": "Alpha channel for transparency" 336 } 337 ] 338 }, 339 "identifier": { 340 "interfaceLanguage": "c", 341 "precise": "c:@S@Color@FI@Alpha" 342 }, 343 "kind": { 344 "displayName": "Instance Property", 345 "identifier": "c.property" 346 }, 347 "location": { 348 "position": { 349 "character": 12, 350 "line": 7 351 }, 352 "uri": "file://INPUT_DIR/input.h" 353 }, 354 "names": { 355 "navigator": [ 356 { 357 "kind": "identifier", 358 "spelling": "Alpha" 359 } 360 ], 361 "subHeading": [ 362 { 363 "kind": "identifier", 364 "spelling": "Alpha" 365 } 366 ], 367 "title": "Alpha" 368 }, 369 "pathComponents": [ 370 "Color", 371 "Alpha" 372 ] 373 } 374 ] 375 } 376