| // RUN: rm -rf %t |
| // RUN: split-file %s %t |
| // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \ |
| // RUN: %t/reference.output.json.in >> %t/reference.output.json |
| // RUN: %clang -extract-api --pretty-sgf --product-name=Pointers -target arm64-apple-macosx \ |
| // RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s |
| |
| // Generator version is not consistent across test runs, normalize it. |
| // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \ |
| // RUN: %t/output.json >> %t/output-normalized.json |
| // RUN: diff %t/reference.output.json %t/output-normalized.json |
| |
| // CHECK-NOT: error: |
| // CHECK-NOT: warning: |
| |
| //--- input.h |
| void foo(int *a); |
| void bar(int **a); |
| void *baz(); |
| void **qux(); |
| |
| //--- reference.output.json.in |
| { |
| "metadata": { |
| "formatVersion": { |
| "major": 0, |
| "minor": 5, |
| "patch": 3 |
| }, |
| "generator": "?" |
| }, |
| "module": { |
| "name": "Pointers", |
| "platform": { |
| "architecture": "arm64", |
| "operatingSystem": { |
| "minimumVersion": { |
| "major": 11, |
| "minor": 0, |
| "patch": 0 |
| }, |
| "name": "macosx" |
| }, |
| "vendor": "apple" |
| } |
| }, |
| "relationships": [], |
| "symbols": [ |
| { |
| "accessLevel": "public", |
| "declarationFragments": [ |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:v", |
| "spelling": "void" |
| }, |
| { |
| "kind": "text", |
| "spelling": " " |
| }, |
| { |
| "kind": "identifier", |
| "spelling": "foo" |
| }, |
| { |
| "kind": "text", |
| "spelling": "(" |
| }, |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:I", |
| "spelling": "int" |
| }, |
| { |
| "kind": "text", |
| "spelling": " *" |
| }, |
| { |
| "kind": "internalParam", |
| "spelling": "a" |
| }, |
| { |
| "kind": "text", |
| "spelling": ");" |
| } |
| ], |
| "functionSignature": { |
| "parameters": [ |
| { |
| "declarationFragments": [ |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:I", |
| "spelling": "int" |
| }, |
| { |
| "kind": "text", |
| "spelling": " *" |
| }, |
| { |
| "kind": "internalParam", |
| "spelling": "a" |
| } |
| ], |
| "name": "a" |
| } |
| ], |
| "returns": [ |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:v", |
| "spelling": "void" |
| } |
| ] |
| }, |
| "identifier": { |
| "interfaceLanguage": "c", |
| "precise": "c:@F@foo" |
| }, |
| "kind": { |
| "displayName": "Function", |
| "identifier": "c.func" |
| }, |
| "location": { |
| "position": { |
| "character": 5, |
| "line": 0 |
| }, |
| "uri": "file://INPUT_DIR/input.h" |
| }, |
| "names": { |
| "navigator": [ |
| { |
| "kind": "identifier", |
| "spelling": "foo" |
| } |
| ], |
| "subHeading": [ |
| { |
| "kind": "identifier", |
| "spelling": "foo" |
| } |
| ], |
| "title": "foo" |
| }, |
| "pathComponents": [ |
| "foo" |
| ] |
| }, |
| { |
| "accessLevel": "public", |
| "declarationFragments": [ |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:v", |
| "spelling": "void" |
| }, |
| { |
| "kind": "text", |
| "spelling": " " |
| }, |
| { |
| "kind": "identifier", |
| "spelling": "bar" |
| }, |
| { |
| "kind": "text", |
| "spelling": "(" |
| }, |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:I", |
| "spelling": "int" |
| }, |
| { |
| "kind": "text", |
| "spelling": " **" |
| }, |
| { |
| "kind": "internalParam", |
| "spelling": "a" |
| }, |
| { |
| "kind": "text", |
| "spelling": ");" |
| } |
| ], |
| "functionSignature": { |
| "parameters": [ |
| { |
| "declarationFragments": [ |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:I", |
| "spelling": "int" |
| }, |
| { |
| "kind": "text", |
| "spelling": " **" |
| }, |
| { |
| "kind": "internalParam", |
| "spelling": "a" |
| } |
| ], |
| "name": "a" |
| } |
| ], |
| "returns": [ |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:v", |
| "spelling": "void" |
| } |
| ] |
| }, |
| "identifier": { |
| "interfaceLanguage": "c", |
| "precise": "c:@F@bar" |
| }, |
| "kind": { |
| "displayName": "Function", |
| "identifier": "c.func" |
| }, |
| "location": { |
| "position": { |
| "character": 5, |
| "line": 1 |
| }, |
| "uri": "file://INPUT_DIR/input.h" |
| }, |
| "names": { |
| "navigator": [ |
| { |
| "kind": "identifier", |
| "spelling": "bar" |
| } |
| ], |
| "subHeading": [ |
| { |
| "kind": "identifier", |
| "spelling": "bar" |
| } |
| ], |
| "title": "bar" |
| }, |
| "pathComponents": [ |
| "bar" |
| ] |
| }, |
| { |
| "accessLevel": "public", |
| "declarationFragments": [ |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:v", |
| "spelling": "void" |
| }, |
| { |
| "kind": "text", |
| "spelling": " *" |
| }, |
| { |
| "kind": "identifier", |
| "spelling": "baz" |
| }, |
| { |
| "kind": "text", |
| "spelling": "();" |
| } |
| ], |
| "functionSignature": { |
| "returns": [ |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:v", |
| "spelling": "void" |
| }, |
| { |
| "kind": "text", |
| "spelling": " *" |
| } |
| ] |
| }, |
| "identifier": { |
| "interfaceLanguage": "c", |
| "precise": "c:@F@baz" |
| }, |
| "kind": { |
| "displayName": "Function", |
| "identifier": "c.func" |
| }, |
| "location": { |
| "position": { |
| "character": 6, |
| "line": 2 |
| }, |
| "uri": "file://INPUT_DIR/input.h" |
| }, |
| "names": { |
| "navigator": [ |
| { |
| "kind": "identifier", |
| "spelling": "baz" |
| } |
| ], |
| "subHeading": [ |
| { |
| "kind": "identifier", |
| "spelling": "baz" |
| } |
| ], |
| "title": "baz" |
| }, |
| "pathComponents": [ |
| "baz" |
| ] |
| }, |
| { |
| "accessLevel": "public", |
| "declarationFragments": [ |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:v", |
| "spelling": "void" |
| }, |
| { |
| "kind": "text", |
| "spelling": " **" |
| }, |
| { |
| "kind": "identifier", |
| "spelling": "qux" |
| }, |
| { |
| "kind": "text", |
| "spelling": "();" |
| } |
| ], |
| "functionSignature": { |
| "returns": [ |
| { |
| "kind": "typeIdentifier", |
| "preciseIdentifier": "c:v", |
| "spelling": "void" |
| }, |
| { |
| "kind": "text", |
| "spelling": " **" |
| } |
| ] |
| }, |
| "identifier": { |
| "interfaceLanguage": "c", |
| "precise": "c:@F@qux" |
| }, |
| "kind": { |
| "displayName": "Function", |
| "identifier": "c.func" |
| }, |
| "location": { |
| "position": { |
| "character": 7, |
| "line": 3 |
| }, |
| "uri": "file://INPUT_DIR/input.h" |
| }, |
| "names": { |
| "navigator": [ |
| { |
| "kind": "identifier", |
| "spelling": "qux" |
| } |
| ], |
| "subHeading": [ |
| { |
| "kind": "identifier", |
| "spelling": "qux" |
| } |
| ], |
| "title": "qux" |
| }, |
| "pathComponents": [ |
| "qux" |
| ] |
| } |
| ] |
| } |