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 "subHeading": [ 109 { 110 "kind": "identifier", 111 "spelling": "Interface" 112 } 113 ], 114 "title": "Interface" 115 }, 116 "pathComponents": [ 117 "Interface" 118 ] 119 }, 120 { 121 "accessLevel": "public", 122 "declarationFragments": [ 123 { 124 "kind": "text", 125 "spelling": "- (" 126 }, 127 { 128 "kind": "typeIdentifier", 129 "preciseIdentifier": "c:v", 130 "spelling": "void" 131 }, 132 { 133 "kind": "text", 134 "spelling": ") " 135 }, 136 { 137 "kind": "identifier", 138 "spelling": "InstanceMethod" 139 } 140 ], 141 "identifier": { 142 "interfaceLanguage": "objective-c", 143 "precise": "c:objc(cs)Interface(im)InstanceMethod" 144 }, 145 "kind": { 146 "displayName": "Instance Method", 147 "identifier": "objective-c.method" 148 }, 149 "location": { 150 "position": { 151 "character": 1, 152 "line": 8 153 }, 154 "uri": "file://INPUT_DIR/input.h" 155 }, 156 "names": { 157 "subHeading": [ 158 { 159 "kind": "text", 160 "spelling": "- " 161 }, 162 { 163 "kind": "identifier", 164 "spelling": "InstanceMethod" 165 } 166 ], 167 "title": "InstanceMethod" 168 }, 169 "pathComponents": [ 170 "Interface", 171 "InstanceMethod" 172 ] 173 }, 174 { 175 "accessLevel": "public", 176 "declarationFragments": [ 177 { 178 "kind": "text", 179 "spelling": "+ (" 180 }, 181 { 182 "kind": "typeIdentifier", 183 "preciseIdentifier": "c:v", 184 "spelling": "void" 185 }, 186 { 187 "kind": "text", 188 "spelling": ") " 189 }, 190 { 191 "kind": "identifier", 192 "spelling": "ClassMethod" 193 } 194 ], 195 "identifier": { 196 "interfaceLanguage": "objective-c", 197 "precise": "c:objc(cs)Interface(cm)ClassMethod" 198 }, 199 "kind": { 200 "displayName": "Type Method", 201 "identifier": "objective-c.type.method" 202 }, 203 "location": { 204 "position": { 205 "character": 1, 206 "line": 9 207 }, 208 "uri": "file://INPUT_DIR/input.h" 209 }, 210 "names": { 211 "subHeading": [ 212 { 213 "kind": "text", 214 "spelling": "+ " 215 }, 216 { 217 "kind": "identifier", 218 "spelling": "ClassMethod" 219 } 220 ], 221 "title": "ClassMethod" 222 }, 223 "pathComponents": [ 224 "Interface", 225 "ClassMethod" 226 ] 227 }, 228 { 229 "accessLevel": "public", 230 "declarationFragments": [ 231 { 232 "kind": "keyword", 233 "spelling": "@property" 234 }, 235 { 236 "kind": "text", 237 "spelling": " (" 238 }, 239 { 240 "kind": "keyword", 241 "spelling": "atomic" 242 }, 243 { 244 "kind": "text", 245 "spelling": ", " 246 }, 247 { 248 "kind": "keyword", 249 "spelling": "assign" 250 }, 251 { 252 "kind": "text", 253 "spelling": ", " 254 }, 255 { 256 "kind": "keyword", 257 "spelling": "unsafe_unretained" 258 }, 259 { 260 "kind": "text", 261 "spelling": ", " 262 }, 263 { 264 "kind": "keyword", 265 "spelling": "readwrite" 266 }, 267 { 268 "kind": "text", 269 "spelling": ") " 270 }, 271 { 272 "kind": "typeIdentifier", 273 "preciseIdentifier": "c:I", 274 "spelling": "int" 275 }, 276 { 277 "kind": "identifier", 278 "spelling": "Property" 279 } 280 ], 281 "identifier": { 282 "interfaceLanguage": "objective-c", 283 "precise": "c:objc(cs)Interface(py)Property" 284 }, 285 "kind": { 286 "displayName": "Instance Property", 287 "identifier": "objective-c.property" 288 }, 289 "location": { 290 "position": { 291 "character": 15, 292 "line": 7 293 }, 294 "uri": "file://INPUT_DIR/input.h" 295 }, 296 "names": { 297 "subHeading": [ 298 { 299 "kind": "identifier", 300 "spelling": "Property" 301 } 302 ], 303 "title": "Property" 304 }, 305 "pathComponents": [ 306 "Interface", 307 "Property" 308 ] 309 } 310 ] 311} 312