| 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_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx -x objective-c-header %t/input.h -o %t/output.json -verify |
| 6 |
|
| 7 |
// Generator version is not consistent across test runs, normalize it. |
| 8 |
// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \ |
| 9 |
// RUN: %t/output.json >> %t/output-normalized.json |
| 10 |
// RUN: diff %t/reference.output.json %t/output-normalized.json |
| 11 |
|
| 12 |
|
| 13 |
//--- input.h |
| 14 |
@interface Foo |
| 15 |
- (instancetype) init; |
| 16 |
- (id) reset; |
| 17 |
@end |
| 18 |
// expected-no-diagnostics |
| 19 |
|
| 20 |
|
| 21 |
//--- reference.output.json.in |
| 22 |
{ |
| 23 |
"metadata": { |
| 24 |
"formatVersion": { |
| 25 |
"major": 0, |
| 26 |
"minor": 5, |
| 27 |
"patch": 3 |
| 28 |
}, |
| 29 |
"generator": "?" |
| 30 |
}, |
| 31 |
"module": { |
| 32 |
"name": "", |
| 33 |
"platform": { |
| 34 |
"architecture": "arm64", |
| 35 |
"operatingSystem": { |
| 36 |
"minimumVersion": { |
| 37 |
"major": 11, |
| 38 |
"minor": 0, |
| 39 |
"patch": 0 |
| 40 |
}, |
| 41 |
"name": "macosx" |
| 42 |
}, |
| 43 |
"vendor": "apple" |
| 44 |
} |
| 45 |
}, |
| 46 |
"relationships": [ |
| 47 |
{ |
| 48 |
"kind": "memberOf", |
| 49 |
"source": "c:objc(cs)Foo(im)init", |
| 50 |
"target": "c:objc(cs)Foo", |
| 51 |
"targetFallback": "Foo" |
| 52 |
}, |
| 53 |
{ |
| 54 |
"kind": "memberOf", |
| 55 |
"source": "c:objc(cs)Foo(im)reset", |
| 56 |
"target": "c:objc(cs)Foo", |
| 57 |
"targetFallback": "Foo" |
| 58 |
} |
| 59 |
], |
| 60 |
"symbols": [ |
| 61 |
{ |
| 62 |
"accessLevel": "public", |
| 63 |
"declarationFragments": [ |
| 64 |
{ |
| 65 |
"kind": "keyword", |
| 66 |
"spelling": "@interface" |
| 67 |
}, |
| 68 |
{ |
| 69 |
"kind": "text", |
| 70 |
"spelling": " " |
| 71 |
}, |
| 72 |
{ |
| 73 |
"kind": "identifier", |
| 74 |
"spelling": "Foo" |
| 75 |
} |
| 76 |
], |
| 77 |
"identifier": { |
| 78 |
"interfaceLanguage": "objective-c", |
| 79 |
"precise": "c:objc(cs)Foo" |
| 80 |
}, |
| 81 |
"kind": { |
| 82 |
"displayName": "Class", |
| 83 |
"identifier": "objective-c.class" |
| 84 |
}, |
| 85 |
"location": { |
| 86 |
"position": { |
| 87 |
"character": 11, |
| 88 |
"line": 0 |
| 89 |
}, |
| 90 |
"uri": "file://INPUT_DIR/input.h" |
| 91 |
}, |
| 92 |
"names": { |
| 93 |
"navigator": [ |
| 94 |
{ |
| 95 |
"kind": "identifier", |
| 96 |
"spelling": "Foo" |
| 97 |
} |
| 98 |
], |
| 99 |
"subHeading": [ |
| 100 |
{ |
| 101 |
"kind": "identifier", |
| 102 |
"spelling": "Foo" |
| 103 |
} |
| 104 |
], |
| 105 |
"title": "Foo" |
| 106 |
}, |
| 107 |
"pathComponents": [ |
| 108 |
"Foo" |
| 109 |
] |
| 110 |
}, |
| 111 |
{ |
| 112 |
"accessLevel": "public", |
| 113 |
"declarationFragments": [ |
| 114 |
{ |
| 115 |
"kind": "text", |
| 116 |
"spelling": "- (" |
| 117 |
}, |
| 118 |
{ |
| 119 |
"kind": "keyword", |
| 120 |
"spelling": "instancetype" |
| 121 |
}, |
| 122 |
{ |
| 123 |
"kind": "text", |
| 124 |
"spelling": ") " |
| 125 |
}, |
| 126 |
{ |
| 127 |
"kind": "identifier", |
| 128 |
"spelling": "init" |
| 129 |
}, |
| 130 |
{ |
| 131 |
"kind": "text", |
| 132 |
"spelling": ";" |
| 133 |
} |
| 134 |
], |
| 135 |
"functionSignature": { |
| 136 |
"returns": [ |
| 137 |
{ |
| 138 |
"kind": "keyword", |
| 139 |
"spelling": "instancetype" |
| 140 |
} |
| 141 |
] |
| 142 |
}, |
| 143 |
"identifier": { |
| 144 |
"interfaceLanguage": "objective-c", |
| 145 |
"precise": "c:objc(cs)Foo(im)init" |
| 146 |
}, |
| 147 |
"kind": { |
| 148 |
"displayName": "Instance Method", |
| 149 |
"identifier": "objective-c.method" |
| 150 |
}, |
| 151 |
"location": { |
| 152 |
"position": { |
| 153 |
"character": 0, |
| 154 |
"line": 1 |
| 155 |
}, |
| 156 |
"uri": "file://INPUT_DIR/input.h" |
| 157 |
}, |
| 158 |
"names": { |
| 159 |
"navigator": [ |
| 160 |
{ |
| 161 |
"kind": "text", |
| 162 |
"spelling": "- " |
| 163 |
}, |
| 164 |
{ |
| 165 |
"kind": "identifier", |
| 166 |
"spelling": "init" |
| 167 |
} |
| 168 |
], |
| 169 |
"subHeading": [ |
| 170 |
{ |
| 171 |
"kind": "text", |
| 172 |
"spelling": "- " |
| 173 |
}, |
| 174 |
{ |
| 175 |
"kind": "identifier", |
| 176 |
"spelling": "init" |
| 177 |
} |
| 178 |
], |
| 179 |
"title": "init" |
| 180 |
}, |
| 181 |
"pathComponents": [ |
| 182 |
"Foo", |
| 183 |
"init" |
| 184 |
] |
| 185 |
}, |
| 186 |
{ |
| 187 |
"accessLevel": "public", |
| 188 |
"declarationFragments": [ |
| 189 |
{ |
| 190 |
"kind": "text", |
| 191 |
"spelling": "- (" |
| 192 |
}, |
| 193 |
{ |
| 194 |
"kind": "keyword", |
| 195 |
"spelling": "id" |
| 196 |
}, |
| 197 |
{ |
| 198 |
"kind": "text", |
| 199 |
"spelling": ") " |
| 200 |
}, |
| 201 |
{ |
| 202 |
"kind": "identifier", |
| 203 |
"spelling": "reset" |
| 204 |
}, |
| 205 |
{ |
| 206 |
"kind": "text", |
| 207 |
"spelling": ";" |
| 208 |
} |
| 209 |
], |
| 210 |
"functionSignature": { |
| 211 |
"returns": [ |
| 212 |
{ |
| 213 |
"kind": "keyword", |
| 214 |
"spelling": "id" |
| 215 |
} |
| 216 |
] |
| 217 |
}, |
| 218 |
"identifier": { |
| 219 |
"interfaceLanguage": "objective-c", |
| 220 |
"precise": "c:objc(cs)Foo(im)reset" |
| 221 |
}, |
| 222 |
"kind": { |
| 223 |
"displayName": "Instance Method", |
| 224 |
"identifier": "objective-c.method" |
| 225 |
}, |
| 226 |
"location": { |
| 227 |
"position": { |
| 228 |
"character": 0, |
| 229 |
"line": 2 |
| 230 |
}, |
| 231 |
"uri": "file://INPUT_DIR/input.h" |
| 232 |
}, |
| 233 |
"names": { |
| 234 |
"navigator": [ |
| 235 |
{ |
| 236 |
"kind": "text", |
| 237 |
"spelling": "- " |
| 238 |
}, |
| 239 |
{ |
| 240 |
"kind": "identifier", |
| 241 |
"spelling": "reset" |
| 242 |
} |
| 243 |
], |
| 244 |
"subHeading": [ |
| 245 |
{ |
| 246 |
"kind": "text", |
| 247 |
"spelling": "- " |
| 248 |
}, |
| 249 |
{ |
| 250 |
"kind": "identifier", |
| 251 |
"spelling": "reset" |
| 252 |
} |
| 253 |
], |
| 254 |
"title": "reset" |
| 255 |
}, |
| 256 |
"pathComponents": [ |
| 257 |
"Foo", |
| 258 |
"reset" |
| 259 |
] |
| 260 |
} |
| 261 |
] |
| 262 |
} |