brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.7 KiB · 8f8300b Raw
282 lines · c
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 -x c-header\6// RUN:   %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.h14/// My Union15union Union {16    /// the a option17    int a;18    /// the b option19    char b;20};21// expected-no-diagnostics22 23//--- reference.output.json.in24{25  "metadata": {26    "formatVersion": {27      "major": 0,28      "minor": 5,29      "patch": 330    },31    "generator": "?"32  },33  "module": {34    "name": "",35    "platform": {36      "architecture": "arm64",37      "operatingSystem": {38        "minimumVersion": {39          "major": 11,40          "minor": 0,41          "patch": 042        },43        "name": "macosx"44      },45      "vendor": "apple"46    }47  },48  "relationships": [49    {50      "kind": "memberOf",51      "source": "c:@U@Union@FI@a",52      "target": "c:@U@Union",53      "targetFallback": "Union"54    },55    {56      "kind": "memberOf",57      "source": "c:@U@Union@FI@b",58      "target": "c:@U@Union",59      "targetFallback": "Union"60    }61  ],62  "symbols": [63    {64      "accessLevel": "public",65      "declarationFragments": [66        {67          "kind": "keyword",68          "spelling": "union"69        },70        {71          "kind": "text",72          "spelling": " "73        },74        {75          "kind": "identifier",76          "spelling": "Union"77        },78        {79          "kind": "text",80          "spelling": ";"81        }82      ],83      "docComment": {84        "lines": [85          {86            "range": {87              "end": {88                "character": 12,89                "line": 090              },91              "start": {92                "character": 4,93                "line": 094              }95            },96            "text": "My Union"97          }98        ]99      },100      "identifier": {101        "interfaceLanguage": "c",102        "precise": "c:@U@Union"103      },104      "kind": {105        "displayName": "Union",106        "identifier": "c.union"107      },108      "location": {109        "position": {110          "character": 6,111          "line": 1112        },113        "uri": "file://INPUT_DIR/input.h"114      },115      "names": {116        "navigator": [117          {118            "kind": "identifier",119            "spelling": "Union"120          }121        ],122        "subHeading": [123          {124            "kind": "identifier",125            "spelling": "Union"126          }127        ],128        "title": "Union"129      },130      "pathComponents": [131        "Union"132      ]133    },134    {135      "accessLevel": "public",136      "declarationFragments": [137        {138          "kind": "typeIdentifier",139          "preciseIdentifier": "c:I",140          "spelling": "int"141        },142        {143          "kind": "text",144          "spelling": " "145        },146        {147          "kind": "identifier",148          "spelling": "a"149        },150        {151          "kind": "text",152          "spelling": ";"153        }154      ],155      "docComment": {156        "lines": [157          {158            "range": {159              "end": {160                "character": 20,161                "line": 2162              },163              "start": {164                "character": 8,165                "line": 2166              }167            },168            "text": "the a option"169          }170        ]171      },172      "identifier": {173        "interfaceLanguage": "c",174        "precise": "c:@U@Union@FI@a"175      },176      "kind": {177        "displayName": "Instance Property",178        "identifier": "c.property"179      },180      "location": {181        "position": {182          "character": 8,183          "line": 3184        },185        "uri": "file://INPUT_DIR/input.h"186      },187      "names": {188        "navigator": [189          {190            "kind": "identifier",191            "spelling": "a"192          }193        ],194        "subHeading": [195          {196            "kind": "identifier",197            "spelling": "a"198          }199        ],200        "title": "a"201      },202      "pathComponents": [203        "Union",204        "a"205      ]206    },207    {208      "accessLevel": "public",209      "declarationFragments": [210        {211          "kind": "typeIdentifier",212          "preciseIdentifier": "c:C",213          "spelling": "char"214        },215        {216          "kind": "text",217          "spelling": " "218        },219        {220          "kind": "identifier",221          "spelling": "b"222        },223        {224          "kind": "text",225          "spelling": ";"226        }227      ],228      "docComment": {229        "lines": [230          {231            "range": {232              "end": {233                "character": 20,234                "line": 4235              },236              "start": {237                "character": 8,238                "line": 4239              }240            },241            "text": "the b option"242          }243        ]244      },245      "identifier": {246        "interfaceLanguage": "c",247        "precise": "c:@U@Union@FI@b"248      },249      "kind": {250        "displayName": "Instance Property",251        "identifier": "c.property"252      },253      "location": {254        "position": {255          "character": 9,256          "line": 5257        },258        "uri": "file://INPUT_DIR/input.h"259      },260      "names": {261        "navigator": [262          {263            "kind": "identifier",264            "spelling": "b"265          }266        ],267        "subHeading": [268          {269            "kind": "identifier",270            "spelling": "b"271          }272        ],273        "title": "b"274      },275      "pathComponents": [276        "Union",277        "b"278      ]279    }280  ]281}282