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 "relationhips": [ 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 "declarationFragments": [ 76 { 77 "kind": "keyword", 78 "spelling": "struct" 79 }, 80 { 81 "kind": "text", 82 "spelling": " " 83 }, 84 { 85 "kind": "identifier", 86 "spelling": "Color" 87 } 88 ], 89 "docComment": { 90 "lines": [ 91 { 92 "range": { 93 "end": { 94 "character": 18, 95 "line": 1 96 }, 97 "start": { 98 "character": 5, 99 "line": 1 100 } 101 }, 102 "text": "Color in RGBA" 103 } 104 ] 105 }, 106 "identifier": { 107 "interfaceLanguage": "c", 108 "precise": "c:@S@Color" 109 }, 110 "kind": { 111 "displayName": "Structure", 112 "identifier": "c.struct" 113 }, 114 "location": { 115 "character": 8, 116 "line": 2, 117 "uri": "file://INPUT_DIR/input.h" 118 }, 119 "names": { 120 "subHeading": [ 121 { 122 "kind": "identifier", 123 "spelling": "Color" 124 } 125 ], 126 "title": "Color" 127 } 128 }, 129 { 130 "declarationFragments": [ 131 { 132 "kind": "typeIdentifier", 133 "preciseIdentifier": "c:i", 134 "spelling": "unsigned int" 135 }, 136 { 137 "kind": "text", 138 "spelling": " " 139 }, 140 { 141 "kind": "identifier", 142 "spelling": "Red" 143 } 144 ], 145 "identifier": { 146 "interfaceLanguage": "c", 147 "precise": "c:@S@Color@FI@Red" 148 }, 149 "kind": { 150 "displayName": "Instance Property", 151 "identifier": "c.property" 152 }, 153 "location": { 154 "character": 12, 155 "line": 3, 156 "uri": "file://INPUT_DIR/input.h" 157 }, 158 "names": { 159 "subHeading": [ 160 { 161 "kind": "identifier", 162 "spelling": "Red" 163 } 164 ], 165 "title": "Red" 166 } 167 }, 168 { 169 "declarationFragments": [ 170 { 171 "kind": "typeIdentifier", 172 "preciseIdentifier": "c:i", 173 "spelling": "unsigned int" 174 }, 175 { 176 "kind": "text", 177 "spelling": " " 178 }, 179 { 180 "kind": "identifier", 181 "spelling": "Green" 182 } 183 ], 184 "identifier": { 185 "interfaceLanguage": "c", 186 "precise": "c:@S@Color@FI@Green" 187 }, 188 "kind": { 189 "displayName": "Instance Property", 190 "identifier": "c.property" 191 }, 192 "location": { 193 "character": 12, 194 "line": 4, 195 "uri": "file://INPUT_DIR/input.h" 196 }, 197 "names": { 198 "subHeading": [ 199 { 200 "kind": "identifier", 201 "spelling": "Green" 202 } 203 ], 204 "title": "Green" 205 } 206 }, 207 { 208 "declarationFragments": [ 209 { 210 "kind": "typeIdentifier", 211 "preciseIdentifier": "c:i", 212 "spelling": "unsigned int" 213 }, 214 { 215 "kind": "text", 216 "spelling": " " 217 }, 218 { 219 "kind": "identifier", 220 "spelling": "Blue" 221 } 222 ], 223 "identifier": { 224 "interfaceLanguage": "c", 225 "precise": "c:@S@Color@FI@Blue" 226 }, 227 "kind": { 228 "displayName": "Instance Property", 229 "identifier": "c.property" 230 }, 231 "location": { 232 "character": 12, 233 "line": 5, 234 "uri": "file://INPUT_DIR/input.h" 235 }, 236 "names": { 237 "subHeading": [ 238 { 239 "kind": "identifier", 240 "spelling": "Blue" 241 } 242 ], 243 "title": "Blue" 244 } 245 }, 246 { 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": "Alpha" 260 } 261 ], 262 "docComment": { 263 "lines": [ 264 { 265 "range": { 266 "end": { 267 "character": 37, 268 "line": 6 269 }, 270 "start": { 271 "character": 7, 272 "line": 6 273 } 274 }, 275 "text": "Alpha channel for transparency" 276 } 277 ] 278 }, 279 "identifier": { 280 "interfaceLanguage": "c", 281 "precise": "c:@S@Color@FI@Alpha" 282 }, 283 "kind": { 284 "displayName": "Instance Property", 285 "identifier": "c.property" 286 }, 287 "location": { 288 "character": 12, 289 "line": 7, 290 "uri": "file://INPUT_DIR/input.h" 291 }, 292 "names": { 293 "subHeading": [ 294 { 295 "kind": "identifier", 296 "spelling": "Alpha" 297 } 298 ], 299 "title": "Alpha" 300 } 301 } 302 ] 303 } 304