brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.1 KiB · bf91a20 Raw
245 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.h14class Foo {15  template<typename T> void Bar(T Fizz);16};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    {47      "kind": "memberOf",48      "source": "c:@S@Foo@FT@>1#TBar#t0.0#v#",49      "target": "c:@S@Foo",50      "targetFallback": "Foo"51    }52  ],53  "symbols": [54    {55      "accessLevel": "public",56      "declarationFragments": [57        {58          "kind": "keyword",59          "spelling": "class"60        },61        {62          "kind": "text",63          "spelling": " "64        },65        {66          "kind": "identifier",67          "spelling": "Foo"68        },69        {70          "kind": "text",71          "spelling": ";"72        }73      ],74      "identifier": {75        "interfaceLanguage": "c++",76        "precise": "c:@S@Foo"77      },78      "kind": {79        "displayName": "Class",80        "identifier": "c++.class"81      },82      "location": {83        "position": {84          "character": 6,85          "line": 086        },87        "uri": "file://INPUT_DIR/input.h"88      },89      "names": {90        "navigator": [91          {92            "kind": "identifier",93            "spelling": "Foo"94          }95        ],96        "subHeading": [97          {98            "kind": "identifier",99            "spelling": "Foo"100          }101        ],102        "title": "Foo"103      },104      "pathComponents": [105        "Foo"106      ]107    },108    {109      "accessLevel": "private",110      "declarationFragments": [111        {112          "kind": "keyword",113          "spelling": "template"114        },115        {116          "kind": "text",117          "spelling": " <"118        },119        {120          "kind": "keyword",121          "spelling": "typename"122        },123        {124          "kind": "text",125          "spelling": " "126        },127        {128          "kind": "genericParameter",129          "spelling": "T"130        },131        {132          "kind": "text",133          "spelling": "> "134        },135        {136          "kind": "typeIdentifier",137          "preciseIdentifier": "c:v",138          "spelling": "void"139        },140        {141          "kind": "text",142          "spelling": " "143        },144        {145          "kind": "identifier",146          "spelling": "Bar"147        },148        {149          "kind": "text",150          "spelling": "("151        },152        {153          "kind": "typeIdentifier",154          "preciseIdentifier": "c:t0.0",155          "spelling": "T"156        },157        {158          "kind": "text",159          "spelling": " "160        },161        {162          "kind": "internalParam",163          "spelling": "Fizz"164        },165        {166          "kind": "text",167          "spelling": ");"168        }169      ],170      "functionSignature": {171        "parameters": [172          {173            "declarationFragments": [174              {175                "kind": "typeIdentifier",176                "preciseIdentifier": "c:t0.0",177                "spelling": "T"178              },179              {180                "kind": "text",181                "spelling": " "182              },183              {184                "kind": "internalParam",185                "spelling": "Fizz"186              }187            ],188            "name": "Fizz"189          }190        ],191        "returns": [192          {193            "kind": "typeIdentifier",194            "preciseIdentifier": "c:v",195            "spelling": "void"196          }197        ]198      },199      "identifier": {200        "interfaceLanguage": "c++",201        "precise": "c:@S@Foo@FT@>1#TBar#t0.0#v#"202      },203      "kind": {204        "displayName": "Method Template",205        "identifier": "c++.method"206      },207      "location": {208        "position": {209          "character": 28,210          "line": 1211        },212        "uri": "file://INPUT_DIR/input.h"213      },214      "names": {215        "navigator": [216          {217            "kind": "identifier",218            "spelling": "Bar"219          }220        ],221        "subHeading": [222          {223            "kind": "identifier",224            "spelling": "Bar"225          }226        ],227        "title": "Bar"228      },229      "pathComponents": [230        "Foo",231        "Bar"232      ],233      "swiftGenerics": {234        "parameters": [235          {236            "depth": 0,237            "index": 0,238            "name": "T"239          }240        ]241      }242    }243  ]244}245