262 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.h14template<typename X, typename Y> class Foo {};15 16template<typename Z> class Foo<Z, int> {};17 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": "",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": "keyword",52 "spelling": "template"53 },54 {55 "kind": "text",56 "spelling": " <"57 },58 {59 "kind": "keyword",60 "spelling": "typename"61 },62 {63 "kind": "text",64 "spelling": " "65 },66 {67 "kind": "genericParameter",68 "spelling": "X"69 },70 {71 "kind": "text",72 "spelling": ", "73 },74 {75 "kind": "keyword",76 "spelling": "typename"77 },78 {79 "kind": "text",80 "spelling": " "81 },82 {83 "kind": "genericParameter",84 "spelling": "Y"85 },86 {87 "kind": "text",88 "spelling": "> "89 },90 {91 "kind": "keyword",92 "spelling": "class"93 },94 {95 "kind": "text",96 "spelling": " "97 },98 {99 "kind": "identifier",100 "spelling": "Foo"101 },102 {103 "kind": "text",104 "spelling": ";"105 }106 ],107 "identifier": {108 "interfaceLanguage": "c++",109 "precise": "c:@ST>2#T#T@Foo"110 },111 "kind": {112 "displayName": "Class",113 "identifier": "c++.class"114 },115 "location": {116 "position": {117 "character": 39,118 "line": 0119 },120 "uri": "file://INPUT_DIR/input.h"121 },122 "names": {123 "navigator": [124 {125 "kind": "identifier",126 "spelling": "Foo"127 }128 ],129 "subHeading": [130 {131 "kind": "identifier",132 "spelling": "Foo"133 }134 ],135 "title": "Foo"136 },137 "pathComponents": [138 "Foo"139 ],140 "swiftGenerics": {141 "parameters": [142 {143 "depth": 0,144 "index": 0,145 "name": "X"146 },147 {148 "depth": 0,149 "index": 1,150 "name": "Y"151 }152 ]153 }154 },155 {156 "accessLevel": "public",157 "declarationFragments": [158 {159 "kind": "keyword",160 "spelling": "template"161 },162 {163 "kind": "text",164 "spelling": " <"165 },166 {167 "kind": "keyword",168 "spelling": "typename"169 },170 {171 "kind": "text",172 "spelling": " "173 },174 {175 "kind": "genericParameter",176 "spelling": "Z"177 },178 {179 "kind": "text",180 "spelling": "> "181 },182 {183 "kind": "keyword",184 "spelling": "class"185 },186 {187 "kind": "text",188 "spelling": " "189 },190 {191 "kind": "identifier",192 "spelling": "Foo"193 },194 {195 "kind": "text",196 "spelling": "<"197 },198 {199 "kind": "typeIdentifier",200 "preciseIdentifier": "c:t0.0",201 "spelling": "Z"202 },203 {204 "kind": "text",205 "spelling": ", "206 },207 {208 "kind": "typeIdentifier",209 "preciseIdentifier": "c:I",210 "spelling": "int"211 },212 {213 "kind": "text",214 "spelling": ">;"215 }216 ],217 "identifier": {218 "interfaceLanguage": "c++",219 "precise": "c:@SP>1#T@Foo>#t0.0#I"220 },221 "kind": {222 "displayName": "Class",223 "identifier": "c++.class"224 },225 "location": {226 "position": {227 "character": 27,228 "line": 2229 },230 "uri": "file://INPUT_DIR/input.h"231 },232 "names": {233 "navigator": [234 {235 "kind": "identifier",236 "spelling": "Foo"237 }238 ],239 "subHeading": [240 {241 "kind": "identifier",242 "spelling": "Foo"243 }244 ],245 "title": "Foo"246 },247 "pathComponents": [248 "Foo"249 ],250 "swiftGenerics": {251 "parameters": [252 {253 "depth": 0,254 "index": 0,255 "name": "Z"256 }257 ]258 }259 }260 ]261}262