brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.4 KiB · b88063a Raw
300 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 T> void Foo(T Bar);15 16template<> void Foo<int>(int Bar);17/// expected-no-diagnostics18 19//--- reference.output.json.in20{21  "metadata": {22    "formatVersion": {23      "major": 0,24      "minor": 5,25      "patch": 326    },27    "generator": "?"28  },29  "module": {30    "name": "",31    "platform": {32      "architecture": "arm64",33      "operatingSystem": {34        "minimumVersion": {35          "major": 11,36          "minor": 0,37          "patch": 038        },39        "name": "macosx"40      },41      "vendor": "apple"42    }43  },44  "relationships": [],45  "symbols": [46    {47      "accessLevel": "public",48      "declarationFragments": [49        {50          "kind": "keyword",51          "spelling": "template"52        },53        {54          "kind": "text",55          "spelling": " <"56        },57        {58          "kind": "keyword",59          "spelling": "typename"60        },61        {62          "kind": "text",63          "spelling": " "64        },65        {66          "kind": "genericParameter",67          "spelling": "T"68        },69        {70          "kind": "text",71          "spelling": "> "72        },73        {74          "kind": "typeIdentifier",75          "preciseIdentifier": "c:v",76          "spelling": "void"77        },78        {79          "kind": "text",80          "spelling": " "81        },82        {83          "kind": "identifier",84          "spelling": "Foo"85        },86        {87          "kind": "text",88          "spelling": "("89        },90        {91          "kind": "typeIdentifier",92          "preciseIdentifier": "c:t0.0",93          "spelling": "T"94        },95        {96          "kind": "text",97          "spelling": " "98        },99        {100          "kind": "internalParam",101          "spelling": "Bar"102        },103        {104          "kind": "text",105          "spelling": ");"106        }107      ],108      "functionSignature": {109        "parameters": [110          {111            "declarationFragments": [112              {113                "kind": "typeIdentifier",114                "preciseIdentifier": "c:t0.0",115                "spelling": "T"116              },117              {118                "kind": "text",119                "spelling": " "120              },121              {122                "kind": "internalParam",123                "spelling": "Bar"124              }125            ],126            "name": "Bar"127          }128        ],129        "returns": [130          {131            "kind": "typeIdentifier",132            "preciseIdentifier": "c:v",133            "spelling": "void"134          }135        ]136      },137      "identifier": {138        "interfaceLanguage": "c++",139        "precise": "c:@FT@>1#TFoo#t0.0#v#"140      },141      "kind": {142        "displayName": "Function Template",143        "identifier": "c++.func"144      },145      "location": {146        "position": {147          "character": 26,148          "line": 0149        },150        "uri": "file://INPUT_DIR/input.h"151      },152      "names": {153        "navigator": [154          {155            "kind": "identifier",156            "spelling": "Foo"157          }158        ],159        "subHeading": [160          {161            "kind": "identifier",162            "spelling": "Foo"163          }164        ],165        "title": "Foo"166      },167      "pathComponents": [168        "Foo"169      ],170      "swiftGenerics": {171        "parameters": [172          {173            "depth": 0,174            "index": 0,175            "name": "T"176          }177        ]178      }179    },180    {181      "accessLevel": "public",182      "declarationFragments": [183        {184          "kind": "keyword",185          "spelling": "template"186        },187        {188          "kind": "text",189          "spelling": " <> "190        },191        {192          "kind": "typeIdentifier",193          "preciseIdentifier": "c:v",194          "spelling": "void"195        },196        {197          "kind": "text",198          "spelling": " "199        },200        {201          "kind": "identifier",202          "spelling": "Foo"203        },204        {205          "kind": "text",206          "spelling": "<"207        },208        {209          "kind": "typeIdentifier",210          "preciseIdentifier": "c:I",211          "spelling": "int"212        },213        {214          "kind": "text",215          "spelling": ">("216        },217        {218          "kind": "typeIdentifier",219          "preciseIdentifier": "c:I",220          "spelling": "int"221        },222        {223          "kind": "text",224          "spelling": " "225        },226        {227          "kind": "internalParam",228          "spelling": "Bar"229        },230        {231          "kind": "text",232          "spelling": ");"233        }234      ],235      "functionSignature": {236        "parameters": [237          {238            "declarationFragments": [239              {240                "kind": "typeIdentifier",241                "preciseIdentifier": "c:I",242                "spelling": "int"243              },244              {245                "kind": "text",246                "spelling": " "247              },248              {249                "kind": "internalParam",250                "spelling": "Bar"251              }252            ],253            "name": "Bar"254          }255        ],256        "returns": [257          {258            "kind": "typeIdentifier",259            "preciseIdentifier": "c:v",260            "spelling": "void"261          }262        ]263      },264      "identifier": {265        "interfaceLanguage": "c++",266        "precise": "c:@F@Foo<#I>#I#"267      },268      "kind": {269        "displayName": "Function Template Specialization",270        "identifier": "c++.func"271      },272      "location": {273        "position": {274          "character": 16,275          "line": 2276        },277        "uri": "file://INPUT_DIR/input.h"278      },279      "names": {280        "navigator": [281          {282            "kind": "identifier",283            "spelling": "Foo"284          }285        ],286        "subHeading": [287          {288            "kind": "identifier",289            "spelling": "Foo"290          }291        ],292        "title": "Foo"293      },294      "pathComponents": [295        "Foo"296      ]297    }298  ]299}300