372 lines · cpp
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 --pretty-sgf -triple arm64-apple-macosx \6// RUN: -x c++-header %t/input.h -o %t/output.json -verify7 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.h14class Foo {15 template<typename T> void Bar(T Fizz);16 17 template<> void Bar<int>(int Fizz);18};19 20/// expected-no-diagnostics21 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": "",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 {49 "kind": "memberOf",50 "source": "c:@S@Foo@FT@>1#TBar#t0.0#v#",51 "target": "c:@S@Foo",52 "targetFallback": "Foo"53 },54 {55 "kind": "memberOf",56 "source": "c:@S@Foo@F@Bar<#I>#I#",57 "target": "c:@S@Foo",58 "targetFallback": "Foo"59 }60 ],61 "symbols": [62 {63 "accessLevel": "public",64 "declarationFragments": [65 {66 "kind": "keyword",67 "spelling": "class"68 },69 {70 "kind": "text",71 "spelling": " "72 },73 {74 "kind": "identifier",75 "spelling": "Foo"76 },77 {78 "kind": "text",79 "spelling": ";"80 }81 ],82 "identifier": {83 "interfaceLanguage": "c++",84 "precise": "c:@S@Foo"85 },86 "kind": {87 "displayName": "Class",88 "identifier": "c++.class"89 },90 "location": {91 "position": {92 "character": 6,93 "line": 094 },95 "uri": "file://INPUT_DIR/input.h"96 },97 "names": {98 "navigator": [99 {100 "kind": "identifier",101 "spelling": "Foo"102 }103 ],104 "subHeading": [105 {106 "kind": "identifier",107 "spelling": "Foo"108 }109 ],110 "title": "Foo"111 },112 "pathComponents": [113 "Foo"114 ]115 },116 {117 "accessLevel": "private",118 "declarationFragments": [119 {120 "kind": "keyword",121 "spelling": "template"122 },123 {124 "kind": "text",125 "spelling": " <"126 },127 {128 "kind": "keyword",129 "spelling": "typename"130 },131 {132 "kind": "text",133 "spelling": " "134 },135 {136 "kind": "genericParameter",137 "spelling": "T"138 },139 {140 "kind": "text",141 "spelling": "> "142 },143 {144 "kind": "typeIdentifier",145 "preciseIdentifier": "c:v",146 "spelling": "void"147 },148 {149 "kind": "text",150 "spelling": " "151 },152 {153 "kind": "identifier",154 "spelling": "Bar"155 },156 {157 "kind": "text",158 "spelling": "("159 },160 {161 "kind": "typeIdentifier",162 "preciseIdentifier": "c:t0.0",163 "spelling": "T"164 },165 {166 "kind": "text",167 "spelling": " "168 },169 {170 "kind": "internalParam",171 "spelling": "Fizz"172 },173 {174 "kind": "text",175 "spelling": ");"176 }177 ],178 "functionSignature": {179 "parameters": [180 {181 "declarationFragments": [182 {183 "kind": "typeIdentifier",184 "preciseIdentifier": "c:t0.0",185 "spelling": "T"186 },187 {188 "kind": "text",189 "spelling": " "190 },191 {192 "kind": "internalParam",193 "spelling": "Fizz"194 }195 ],196 "name": "Fizz"197 }198 ],199 "returns": [200 {201 "kind": "typeIdentifier",202 "preciseIdentifier": "c:v",203 "spelling": "void"204 }205 ]206 },207 "identifier": {208 "interfaceLanguage": "c++",209 "precise": "c:@S@Foo@FT@>1#TBar#t0.0#v#"210 },211 "kind": {212 "displayName": "Method Template",213 "identifier": "c++.method"214 },215 "location": {216 "position": {217 "character": 28,218 "line": 1219 },220 "uri": "file://INPUT_DIR/input.h"221 },222 "names": {223 "navigator": [224 {225 "kind": "identifier",226 "spelling": "Bar"227 }228 ],229 "subHeading": [230 {231 "kind": "identifier",232 "spelling": "Bar"233 }234 ],235 "title": "Bar"236 },237 "pathComponents": [238 "Foo",239 "Bar"240 ],241 "swiftGenerics": {242 "parameters": [243 {244 "depth": 0,245 "index": 0,246 "name": "T"247 }248 ]249 }250 },251 {252 "accessLevel": "private",253 "declarationFragments": [254 {255 "kind": "keyword",256 "spelling": "template"257 },258 {259 "kind": "text",260 "spelling": " <> "261 },262 {263 "kind": "typeIdentifier",264 "preciseIdentifier": "c:v",265 "spelling": "void"266 },267 {268 "kind": "text",269 "spelling": " "270 },271 {272 "kind": "identifier",273 "spelling": "Bar"274 },275 {276 "kind": "text",277 "spelling": "<"278 },279 {280 "kind": "typeIdentifier",281 "preciseIdentifier": "c:I",282 "spelling": "int"283 },284 {285 "kind": "text",286 "spelling": ">("287 },288 {289 "kind": "typeIdentifier",290 "preciseIdentifier": "c:I",291 "spelling": "int"292 },293 {294 "kind": "text",295 "spelling": " "296 },297 {298 "kind": "internalParam",299 "spelling": "Fizz"300 },301 {302 "kind": "text",303 "spelling": ");"304 }305 ],306 "functionSignature": {307 "parameters": [308 {309 "declarationFragments": [310 {311 "kind": "typeIdentifier",312 "preciseIdentifier": "c:I",313 "spelling": "int"314 },315 {316 "kind": "text",317 "spelling": " "318 },319 {320 "kind": "internalParam",321 "spelling": "Fizz"322 }323 ],324 "name": "Fizz"325 }326 ],327 "returns": [328 {329 "kind": "typeIdentifier",330 "preciseIdentifier": "c:v",331 "spelling": "void"332 }333 ]334 },335 "identifier": {336 "interfaceLanguage": "c++",337 "precise": "c:@S@Foo@F@Bar<#I>#I#"338 },339 "kind": {340 "displayName": "Method Template Specialization",341 "identifier": "c++.method"342 },343 "location": {344 "position": {345 "character": 18,346 "line": 3347 },348 "uri": "file://INPUT_DIR/input.h"349 },350 "names": {351 "navigator": [352 {353 "kind": "identifier",354 "spelling": "Bar"355 }356 ],357 "subHeading": [358 {359 "kind": "identifier",360 "spelling": "Bar"361 }362 ],363 "title": "Bar"364 },365 "pathComponents": [366 "Foo",367 "Bar"368 ]369 }370 ]371}372