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