brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 9dbd887 Raw
207 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> class Foo {};15 16template<> class Foo<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": "T"69        },70        {71          "kind": "text",72          "spelling": "> "73        },74        {75          "kind": "keyword",76          "spelling": "class"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      "identifier": {92        "interfaceLanguage": "c++",93        "precise": "c:@ST>1#T@Foo"94      },95      "kind": {96        "displayName": "Class",97        "identifier": "c++.class"98      },99      "location": {100        "position": {101          "character": 27,102          "line": 0103        },104        "uri": "file://INPUT_DIR/input.h"105      },106      "names": {107        "navigator": [108          {109            "kind": "identifier",110            "spelling": "Foo"111          }112        ],113        "subHeading": [114          {115            "kind": "identifier",116            "spelling": "Foo"117          }118        ],119        "title": "Foo"120      },121      "pathComponents": [122        "Foo"123      ],124      "swiftGenerics": {125        "parameters": [126          {127            "depth": 0,128            "index": 0,129            "name": "T"130          }131        ]132      }133    },134    {135      "accessLevel": "public",136      "declarationFragments": [137        {138          "kind": "keyword",139          "spelling": "template"140        },141        {142          "kind": "text",143          "spelling": " <> "144        },145        {146          "kind": "keyword",147          "spelling": "class"148        },149        {150          "kind": "text",151          "spelling": " "152        },153        {154          "kind": "identifier",155          "spelling": "Foo"156        },157        {158          "kind": "text",159          "spelling": "<"160        },161        {162          "kind": "typeIdentifier",163          "preciseIdentifier": "c:I",164          "spelling": "int"165        },166        {167          "kind": "text",168          "spelling": ">;"169        }170      ],171      "identifier": {172        "interfaceLanguage": "c++",173        "precise": "c:@S@Foo>#I"174      },175      "kind": {176        "displayName": "Class",177        "identifier": "c++.class"178      },179      "location": {180        "position": {181          "character": 17,182          "line": 2183        },184        "uri": "file://INPUT_DIR/input.h"185      },186      "names": {187        "navigator": [188          {189            "kind": "identifier",190            "spelling": "Foo"191          }192        ],193        "subHeading": [194          {195            "kind": "identifier",196            "spelling": "Foo"197          }198        ],199        "title": "Foo"200      },201      "pathComponents": [202        "Foo"203      ]204    }205  ]206}207