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 /// 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 "subHeading": [ 124 { 125 "kind": "identifier", 126 "spelling": "Color" 127 } 128 ], 129 "title": "Color" 130 }, 131 "pathComponents": [ 132 "Color" 133 ] 134 }, 135 { 136 "accessLevel": "public", 137 "declarationFragments": [ 138 { 139 "kind": "typeIdentifier", 140 "preciseIdentifier": "c:i", 141 "spelling": "unsigned int" 142 }, 143 { 144 "kind": "text", 145 "spelling": " " 146 }, 147 { 148 "kind": "identifier", 149 "spelling": "Red" 150 } 151 ], 152 "identifier": { 153 "interfaceLanguage": "c", 154 "precise": "c:@S@Color@FI@Red" 155 }, 156 "kind": { 157 "displayName": "Instance Property", 158 "identifier": "c.property" 159 }, 160 "location": { 161 "position": { 162 "character": 12, 163 "line": 3 164 }, 165 "uri": "file://INPUT_DIR/input.h" 166 }, 167 "names": { 168 "subHeading": [ 169 { 170 "kind": "identifier", 171 "spelling": "Red" 172 } 173 ], 174 "title": "Red" 175 }, 176 "pathComponents": [ 177 "Color", 178 "Red" 179 ] 180 }, 181 { 182 "accessLevel": "public", 183 "declarationFragments": [ 184 { 185 "kind": "typeIdentifier", 186 "preciseIdentifier": "c:i", 187 "spelling": "unsigned int" 188 }, 189 { 190 "kind": "text", 191 "spelling": " " 192 }, 193 { 194 "kind": "identifier", 195 "spelling": "Green" 196 } 197 ], 198 "identifier": { 199 "interfaceLanguage": "c", 200 "precise": "c:@S@Color@FI@Green" 201 }, 202 "kind": { 203 "displayName": "Instance Property", 204 "identifier": "c.property" 205 }, 206 "location": { 207 "position": { 208 "character": 12, 209 "line": 4 210 }, 211 "uri": "file://INPUT_DIR/input.h" 212 }, 213 "names": { 214 "subHeading": [ 215 { 216 "kind": "identifier", 217 "spelling": "Green" 218 } 219 ], 220 "title": "Green" 221 }, 222 "pathComponents": [ 223 "Color", 224 "Green" 225 ] 226 }, 227 { 228 "accessLevel": "public", 229 "declarationFragments": [ 230 { 231 "kind": "typeIdentifier", 232 "preciseIdentifier": "c:i", 233 "spelling": "unsigned int" 234 }, 235 { 236 "kind": "text", 237 "spelling": " " 238 }, 239 { 240 "kind": "identifier", 241 "spelling": "Blue" 242 } 243 ], 244 "identifier": { 245 "interfaceLanguage": "c", 246 "precise": "c:@S@Color@FI@Blue" 247 }, 248 "kind": { 249 "displayName": "Instance Property", 250 "identifier": "c.property" 251 }, 252 "location": { 253 "position": { 254 "character": 12, 255 "line": 5 256 }, 257 "uri": "file://INPUT_DIR/input.h" 258 }, 259 "names": { 260 "subHeading": [ 261 { 262 "kind": "identifier", 263 "spelling": "Blue" 264 } 265 ], 266 "title": "Blue" 267 }, 268 "pathComponents": [ 269 "Color", 270 "Blue" 271 ] 272 }, 273 { 274 "accessLevel": "public", 275 "declarationFragments": [ 276 { 277 "kind": "typeIdentifier", 278 "preciseIdentifier": "c:i", 279 "spelling": "unsigned int" 280 }, 281 { 282 "kind": "text", 283 "spelling": " " 284 }, 285 { 286 "kind": "identifier", 287 "spelling": "Alpha" 288 } 289 ], 290 "docComment": { 291 "lines": [ 292 { 293 "range": { 294 "end": { 295 "character": 37, 296 "line": 6 297 }, 298 "start": { 299 "character": 7, 300 "line": 6 301 } 302 }, 303 "text": "Alpha channel for transparency" 304 } 305 ] 306 }, 307 "identifier": { 308 "interfaceLanguage": "c", 309 "precise": "c:@S@Color@FI@Alpha" 310 }, 311 "kind": { 312 "displayName": "Instance Property", 313 "identifier": "c.property" 314 }, 315 "location": { 316 "position": { 317 "character": 12, 318 "line": 7 319 }, 320 "uri": "file://INPUT_DIR/input.h" 321 }, 322 "names": { 323 "subHeading": [ 324 { 325 "kind": "identifier", 326 "spelling": "Alpha" 327 } 328 ], 329 "title": "Alpha" 330 }, 331 "pathComponents": [ 332 "Color", 333 "Alpha" 334 ] 335 } 336 ] 337 } 338