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