389 lines · c
1// RUN: rm -rf %t2// RUN: split-file %s %t3// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \4// RUN: %t/reference.output.json.in >> %t/reference.output.json5// RUN: %clang -extract-api --pretty-sgf --product-name=Pointers -target arm64-apple-macosx \6// RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s7 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.json11// RUN: diff %t/reference.output.json %t/output-normalized.json12 13// CHECK-NOT: error:14// CHECK-NOT: warning:15 16//--- input.h17void foo(int *a);18void bar(int **a);19void *baz();20void **qux();21 22//--- reference.output.json.in23{24 "metadata": {25 "formatVersion": {26 "major": 0,27 "minor": 5,28 "patch": 329 },30 "generator": "?"31 },32 "module": {33 "name": "Pointers",34 "platform": {35 "architecture": "arm64",36 "operatingSystem": {37 "minimumVersion": {38 "major": 11,39 "minor": 0,40 "patch": 041 },42 "name": "macosx"43 },44 "vendor": "apple"45 }46 },47 "relationships": [],48 "symbols": [49 {50 "accessLevel": "public",51 "declarationFragments": [52 {53 "kind": "typeIdentifier",54 "preciseIdentifier": "c:v",55 "spelling": "void"56 },57 {58 "kind": "text",59 "spelling": " "60 },61 {62 "kind": "identifier",63 "spelling": "foo"64 },65 {66 "kind": "text",67 "spelling": "("68 },69 {70 "kind": "typeIdentifier",71 "preciseIdentifier": "c:I",72 "spelling": "int"73 },74 {75 "kind": "text",76 "spelling": " *"77 },78 {79 "kind": "internalParam",80 "spelling": "a"81 },82 {83 "kind": "text",84 "spelling": ");"85 }86 ],87 "functionSignature": {88 "parameters": [89 {90 "declarationFragments": [91 {92 "kind": "typeIdentifier",93 "preciseIdentifier": "c:I",94 "spelling": "int"95 },96 {97 "kind": "text",98 "spelling": " *"99 },100 {101 "kind": "internalParam",102 "spelling": "a"103 }104 ],105 "name": "a"106 }107 ],108 "returns": [109 {110 "kind": "typeIdentifier",111 "preciseIdentifier": "c:v",112 "spelling": "void"113 }114 ]115 },116 "identifier": {117 "interfaceLanguage": "c",118 "precise": "c:@F@foo"119 },120 "kind": {121 "displayName": "Function",122 "identifier": "c.func"123 },124 "location": {125 "position": {126 "character": 5,127 "line": 0128 },129 "uri": "file://INPUT_DIR/input.h"130 },131 "names": {132 "navigator": [133 {134 "kind": "identifier",135 "spelling": "foo"136 }137 ],138 "subHeading": [139 {140 "kind": "identifier",141 "spelling": "foo"142 }143 ],144 "title": "foo"145 },146 "pathComponents": [147 "foo"148 ]149 },150 {151 "accessLevel": "public",152 "declarationFragments": [153 {154 "kind": "typeIdentifier",155 "preciseIdentifier": "c:v",156 "spelling": "void"157 },158 {159 "kind": "text",160 "spelling": " "161 },162 {163 "kind": "identifier",164 "spelling": "bar"165 },166 {167 "kind": "text",168 "spelling": "("169 },170 {171 "kind": "typeIdentifier",172 "preciseIdentifier": "c:I",173 "spelling": "int"174 },175 {176 "kind": "text",177 "spelling": " **"178 },179 {180 "kind": "internalParam",181 "spelling": "a"182 },183 {184 "kind": "text",185 "spelling": ");"186 }187 ],188 "functionSignature": {189 "parameters": [190 {191 "declarationFragments": [192 {193 "kind": "typeIdentifier",194 "preciseIdentifier": "c:I",195 "spelling": "int"196 },197 {198 "kind": "text",199 "spelling": " **"200 },201 {202 "kind": "internalParam",203 "spelling": "a"204 }205 ],206 "name": "a"207 }208 ],209 "returns": [210 {211 "kind": "typeIdentifier",212 "preciseIdentifier": "c:v",213 "spelling": "void"214 }215 ]216 },217 "identifier": {218 "interfaceLanguage": "c",219 "precise": "c:@F@bar"220 },221 "kind": {222 "displayName": "Function",223 "identifier": "c.func"224 },225 "location": {226 "position": {227 "character": 5,228 "line": 1229 },230 "uri": "file://INPUT_DIR/input.h"231 },232 "names": {233 "navigator": [234 {235 "kind": "identifier",236 "spelling": "bar"237 }238 ],239 "subHeading": [240 {241 "kind": "identifier",242 "spelling": "bar"243 }244 ],245 "title": "bar"246 },247 "pathComponents": [248 "bar"249 ]250 },251 {252 "accessLevel": "public",253 "declarationFragments": [254 {255 "kind": "typeIdentifier",256 "preciseIdentifier": "c:v",257 "spelling": "void"258 },259 {260 "kind": "text",261 "spelling": " *"262 },263 {264 "kind": "identifier",265 "spelling": "baz"266 },267 {268 "kind": "text",269 "spelling": "();"270 }271 ],272 "functionSignature": {273 "returns": [274 {275 "kind": "typeIdentifier",276 "preciseIdentifier": "c:v",277 "spelling": "void"278 },279 {280 "kind": "text",281 "spelling": " *"282 }283 ]284 },285 "identifier": {286 "interfaceLanguage": "c",287 "precise": "c:@F@baz"288 },289 "kind": {290 "displayName": "Function",291 "identifier": "c.func"292 },293 "location": {294 "position": {295 "character": 6,296 "line": 2297 },298 "uri": "file://INPUT_DIR/input.h"299 },300 "names": {301 "navigator": [302 {303 "kind": "identifier",304 "spelling": "baz"305 }306 ],307 "subHeading": [308 {309 "kind": "identifier",310 "spelling": "baz"311 }312 ],313 "title": "baz"314 },315 "pathComponents": [316 "baz"317 ]318 },319 {320 "accessLevel": "public",321 "declarationFragments": [322 {323 "kind": "typeIdentifier",324 "preciseIdentifier": "c:v",325 "spelling": "void"326 },327 {328 "kind": "text",329 "spelling": " **"330 },331 {332 "kind": "identifier",333 "spelling": "qux"334 },335 {336 "kind": "text",337 "spelling": "();"338 }339 ],340 "functionSignature": {341 "returns": [342 {343 "kind": "typeIdentifier",344 "preciseIdentifier": "c:v",345 "spelling": "void"346 },347 {348 "kind": "text",349 "spelling": " **"350 }351 ]352 },353 "identifier": {354 "interfaceLanguage": "c",355 "precise": "c:@F@qux"356 },357 "kind": {358 "displayName": "Function",359 "identifier": "c.func"360 },361 "location": {362 "position": {363 "character": 7,364 "line": 3365 },366 "uri": "file://INPUT_DIR/input.h"367 },368 "names": {369 "navigator": [370 {371 "kind": "identifier",372 "spelling": "qux"373 }374 ],375 "subHeading": [376 {377 "kind": "identifier",378 "spelling": "qux"379 }380 ],381 "title": "qux"382 },383 "pathComponents": [384 "qux"385 ]386 }387 ]388}389