llvm-project
133 строки · 2.8 Кб
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 \
6// RUN: -x c++-header %t/input.h -o %t/output.json -verify
7
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.json
11// RUN: diff %t/reference.output.json %t/output-normalized.json
12
13//--- input.h
14template<typename T> class Foo {};15
16/// expected-no-diagnostics
17
18//--- reference.output.json.in
19{
20"metadata": {21"formatVersion": {22"major": 0,23"minor": 5,24"patch": 325},26"generator": "?"27},28"module": {29"name": "",30"platform": {31"architecture": "arm64",32"operatingSystem": {33"minimumVersion": {34"major": 11,35"minor": 0,36"patch": 037},38"name": "macosx"39},40"vendor": "apple"41}42},43"relationships": [],44"symbols": [45{46"accessLevel": "public",47"declarationFragments": [48{49"kind": "keyword",50"spelling": "template"51},52{53"kind": "text",54"spelling": " <"55},56{57"kind": "keyword",58"spelling": "typename"59},60{61"kind": "text",62"spelling": " "63},64{65"kind": "genericParameter",66"spelling": "T"67},68{69"kind": "text",70"spelling": "> "71},72{73"kind": "keyword",74"spelling": "class"75},76{77"kind": "text",78"spelling": " "79},80{81"kind": "identifier",82"spelling": "Foo"83},84{85"kind": "text",86"spelling": ";"87}88],89"identifier": {90"interfaceLanguage": "c++",91"precise": "c:@ST>1#T@Foo"92},93"kind": {94"displayName": "Class",95"identifier": "c++.class"96},97"location": {98"position": {99"character": 27,100"line": 0101},102"uri": "file://INPUT_DIR/input.h"103},104"names": {105"navigator": [106{107"kind": "identifier",108"spelling": "Foo"109}110],111"subHeading": [112{113"kind": "identifier",114"spelling": "Foo"115}116],117"title": "Foo"118},119"pathComponents": [120"Foo"121],122"swiftGenerics": {123"parameters": [124{125"depth": 0,126"index": 0,127"name": "T"128}129]130}131}132]133}
134