brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.4 KiB · ffb1557 Raw
263 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> int Foo = 0;15 16template<typename Z> int Foo<int, Z> = 0;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": "X"68        },69        {70          "kind": "text",71          "spelling": ", "72        },73        {74          "kind": "keyword",75          "spelling": "typename"76        },77        {78          "kind": "text",79          "spelling": " "80        },81        {82          "kind": "genericParameter",83          "spelling": "Y"84        },85        {86          "kind": "text",87          "spelling": "> "88        },89        {90          "kind": "typeIdentifier",91          "preciseIdentifier": "c:I",92          "spelling": "int"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:@Foo"110      },111      "kind": {112        "displayName": "Global Variable Template",113        "identifier": "c++.var"114      },115      "location": {116        "position": {117          "character": 37,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": "typeIdentifier",184          "preciseIdentifier": "c:I",185          "spelling": "int"186        },187        {188          "kind": "text",189          "spelling": " "190        },191        {192          "kind": "identifier",193          "spelling": "Foo"194        },195        {196          "kind": "text",197          "spelling": "<"198        },199        {200          "kind": "typeIdentifier",201          "preciseIdentifier": "c:I",202          "spelling": "int"203        },204        {205          "kind": "text",206          "spelling": ", "207        },208        {209          "kind": "typeIdentifier",210          "preciseIdentifier": "c:t0.0",211          "spelling": "Z"212        },213        {214          "kind": "text",215          "spelling": ">;"216        }217      ],218      "identifier": {219        "interfaceLanguage": "c++",220        "precise": "c:@VP>1#T@Foo>#I#t0.0"221      },222      "kind": {223        "displayName": "Global Variable Template Partial Specialization",224        "identifier": "c++.var"225      },226      "location": {227        "position": {228          "character": 25,229          "line": 2230        },231        "uri": "file://INPUT_DIR/input.h"232      },233      "names": {234        "navigator": [235          {236            "kind": "identifier",237            "spelling": "Foo"238          }239        ],240        "subHeading": [241          {242            "kind": "identifier",243            "spelling": "Foo"244          }245        ],246        "title": "Foo"247      },248      "pathComponents": [249        "Foo"250      ],251      "swiftGenerics": {252        "parameters": [253          {254            "depth": 0,255            "index": 0,256            "name": "Z"257          }258        ]259      }260    }261  ]262}263