205 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_cc1 -extract-api --product-name=BoolTest --pretty-sgf -triple arm64-apple-macosx \6// RUN: %t/input.h -o %t/output.json7 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//--- input.h14#include <stdbool.h>15bool Foo;16 17bool IsFoo(bool Bar);18// expected-no-diagnostics19 20//--- reference.output.json.in21{22 "metadata": {23 "formatVersion": {24 "major": 0,25 "minor": 5,26 "patch": 327 },28 "generator": "?"29 },30 "module": {31 "name": "BoolTest",32 "platform": {33 "architecture": "arm64",34 "operatingSystem": {35 "minimumVersion": {36 "major": 11,37 "minor": 0,38 "patch": 039 },40 "name": "macosx"41 },42 "vendor": "apple"43 }44 },45 "relationships": [],46 "symbols": [47 {48 "accessLevel": "public",49 "declarationFragments": [50 {51 "kind": "typeIdentifier",52 "preciseIdentifier": "c:b",53 "spelling": "bool"54 },55 {56 "kind": "text",57 "spelling": " "58 },59 {60 "kind": "identifier",61 "spelling": "Foo"62 },63 {64 "kind": "text",65 "spelling": ";"66 }67 ],68 "identifier": {69 "interfaceLanguage": "c",70 "precise": "c:@Foo"71 },72 "kind": {73 "displayName": "Global Variable",74 "identifier": "c.var"75 },76 "location": {77 "position": {78 "character": 5,79 "line": 180 },81 "uri": "file://INPUT_DIR/input.h"82 },83 "names": {84 "navigator": [85 {86 "kind": "identifier",87 "spelling": "Foo"88 }89 ],90 "subHeading": [91 {92 "kind": "identifier",93 "spelling": "Foo"94 }95 ],96 "title": "Foo"97 },98 "pathComponents": [99 "Foo"100 ]101 },102 {103 "accessLevel": "public",104 "declarationFragments": [105 {106 "kind": "typeIdentifier",107 "preciseIdentifier": "c:b",108 "spelling": "bool"109 },110 {111 "kind": "text",112 "spelling": " "113 },114 {115 "kind": "identifier",116 "spelling": "IsFoo"117 },118 {119 "kind": "text",120 "spelling": "("121 },122 {123 "kind": "typeIdentifier",124 "preciseIdentifier": "c:b",125 "spelling": "bool"126 },127 {128 "kind": "text",129 "spelling": " "130 },131 {132 "kind": "internalParam",133 "spelling": "Bar"134 },135 {136 "kind": "text",137 "spelling": ");"138 }139 ],140 "functionSignature": {141 "parameters": [142 {143 "declarationFragments": [144 {145 "kind": "typeIdentifier",146 "preciseIdentifier": "c:b",147 "spelling": "bool"148 },149 {150 "kind": "text",151 "spelling": " "152 },153 {154 "kind": "internalParam",155 "spelling": "Bar"156 }157 ],158 "name": "Bar"159 }160 ],161 "returns": [162 {163 "kind": "typeIdentifier",164 "preciseIdentifier": "c:b",165 "spelling": "bool"166 }167 ]168 },169 "identifier": {170 "interfaceLanguage": "c",171 "precise": "c:@F@IsFoo"172 },173 "kind": {174 "displayName": "Function",175 "identifier": "c.func"176 },177 "location": {178 "position": {179 "character": 5,180 "line": 3181 },182 "uri": "file://INPUT_DIR/input.h"183 },184 "names": {185 "navigator": [186 {187 "kind": "identifier",188 "spelling": "IsFoo"189 }190 ],191 "subHeading": [192 {193 "kind": "identifier",194 "spelling": "IsFoo"195 }196 ],197 "title": "IsFoo"198 },199 "pathComponents": [200 "IsFoo"201 ]202 }203 ]204}205