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 "docComment": { 95 "lines": [ 96 { 97 "range": { 98 "end": { 99 "character": 18, 100 "line": 1 101 }, 102 "start": { 103 "character": 5, 104 "line": 1 105 } 106 }, 107 "text": "Color in RGBA" 108 } 109 ] 110 }, 111 "identifier": { 112 "interfaceLanguage": "c", 113 "precise": "c:@S@Color" 114 }, 115 "kind": { 116 "displayName": "Structure", 117 "identifier": "c.struct" 118 }, 119 "location": { 120 "position": { 121 "character": 8, 122 "line": 2 123 }, 124 "uri": "file://INPUT_DIR/input.h" 125 }, 126 "names": { 127 "navigator": [ 128 { 129 "kind": "identifier", 130 "spelling": "Color" 131 } 132 ], 133 "subHeading": [ 134 { 135 "kind": "identifier", 136 "spelling": "Color" 137 } 138 ], 139 "title": "Color" 140 }, 141 "pathComponents": [ 142 "Color" 143 ] 144 }, 145 { 146 "accessLevel": "public", 147 "declarationFragments": [ 148 { 149 "kind": "typeIdentifier", 150 "preciseIdentifier": "c:i", 151 "spelling": "unsigned int" 152 }, 153 { 154 "kind": "text", 155 "spelling": " " 156 }, 157 { 158 "kind": "identifier", 159 "spelling": "Red" 160 } 161 ], 162 "identifier": { 163 "interfaceLanguage": "c", 164 "precise": "c:@S@Color@FI@Red" 165 }, 166 "kind": { 167 "displayName": "Instance Property", 168 "identifier": "c.property" 169 }, 170 "location": { 171 "position": { 172 "character": 12, 173 "line": 3 174 }, 175 "uri": "file://INPUT_DIR/input.h" 176 }, 177 "names": { 178 "navigator": [ 179 { 180 "kind": "identifier", 181 "spelling": "Red" 182 } 183 ], 184 "subHeading": [ 185 { 186 "kind": "identifier", 187 "spelling": "Red" 188 } 189 ], 190 "title": "Red" 191 }, 192 "pathComponents": [ 193 "Color", 194 "Red" 195 ] 196 }, 197 { 198 "accessLevel": "public", 199 "declarationFragments": [ 200 { 201 "kind": "typeIdentifier", 202 "preciseIdentifier": "c:i", 203 "spelling": "unsigned int" 204 }, 205 { 206 "kind": "text", 207 "spelling": " " 208 }, 209 { 210 "kind": "identifier", 211 "spelling": "Green" 212 } 213 ], 214 "identifier": { 215 "interfaceLanguage": "c", 216 "precise": "c:@S@Color@FI@Green" 217 }, 218 "kind": { 219 "displayName": "Instance Property", 220 "identifier": "c.property" 221 }, 222 "location": { 223 "position": { 224 "character": 12, 225 "line": 4 226 }, 227 "uri": "file://INPUT_DIR/input.h" 228 }, 229 "names": { 230 "navigator": [ 231 { 232 "kind": "identifier", 233 "spelling": "Green" 234 } 235 ], 236 "subHeading": [ 237 { 238 "kind": "identifier", 239 "spelling": "Green" 240 } 241 ], 242 "title": "Green" 243 }, 244 "pathComponents": [ 245 "Color", 246 "Green" 247 ] 248 }, 249 { 250 "accessLevel": "public", 251 "declarationFragments": [ 252 { 253 "kind": "typeIdentifier", 254 "preciseIdentifier": "c:i", 255 "spelling": "unsigned int" 256 }, 257 { 258 "kind": "text", 259 "spelling": " " 260 }, 261 { 262 "kind": "identifier", 263 "spelling": "Blue" 264 } 265 ], 266 "identifier": { 267 "interfaceLanguage": "c", 268 "precise": "c:@S@Color@FI@Blue" 269 }, 270 "kind": { 271 "displayName": "Instance Property", 272 "identifier": "c.property" 273 }, 274 "location": { 275 "position": { 276 "character": 12, 277 "line": 5 278 }, 279 "uri": "file://INPUT_DIR/input.h" 280 }, 281 "names": { 282 "navigator": [ 283 { 284 "kind": "identifier", 285 "spelling": "Blue" 286 } 287 ], 288 "subHeading": [ 289 { 290 "kind": "identifier", 291 "spelling": "Blue" 292 } 293 ], 294 "title": "Blue" 295 }, 296 "pathComponents": [ 297 "Color", 298 "Blue" 299 ] 300 }, 301 { 302 "accessLevel": "public", 303 "declarationFragments": [ 304 { 305 "kind": "typeIdentifier", 306 "preciseIdentifier": "c:i", 307 "spelling": "unsigned int" 308 }, 309 { 310 "kind": "text", 311 "spelling": " " 312 }, 313 { 314 "kind": "identifier", 315 "spelling": "Alpha" 316 } 317 ], 318 "docComment": { 319 "lines": [ 320 { 321 "range": { 322 "end": { 323 "character": 37, 324 "line": 6 325 }, 326 "start": { 327 "character": 7, 328 "line": 6 329 } 330 }, 331 "text": "Alpha channel for transparency" 332 } 333 ] 334 }, 335 "identifier": { 336 "interfaceLanguage": "c", 337 "precise": "c:@S@Color@FI@Alpha" 338 }, 339 "kind": { 340 "displayName": "Instance Property", 341 "identifier": "c.property" 342 }, 343 "location": { 344 "position": { 345 "character": 12, 346 "line": 7 347 }, 348 "uri": "file://INPUT_DIR/input.h" 349 }, 350 "names": { 351 "navigator": [ 352 { 353 "kind": "identifier", 354 "spelling": "Alpha" 355 } 356 ], 357 "subHeading": [ 358 { 359 "kind": "identifier", 360 "spelling": "Alpha" 361 } 362 ], 363 "title": "Alpha" 364 }, 365 "pathComponents": [ 366 "Color", 367 "Alpha" 368 ] 369 } 370 ] 371 } 372