134 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> T Foo = T(3.14);15/// expected-no-diagnostics16 17//--- reference.output.json.in18{19 "metadata": {20 "formatVersion": {21 "major": 0,22 "minor": 5,23 "patch": 324 },25 "generator": "?"26 },27 "module": {28 "name": "",29 "platform": {30 "architecture": "arm64",31 "operatingSystem": {32 "minimumVersion": {33 "major": 11,34 "minor": 0,35 "patch": 036 },37 "name": "macosx"38 },39 "vendor": "apple"40 }41 },42 "relationships": [],43 "symbols": [44 {45 "accessLevel": "public",46 "declarationFragments": [47 {48 "kind": "keyword",49 "spelling": "template"50 },51 {52 "kind": "text",53 "spelling": " <"54 },55 {56 "kind": "keyword",57 "spelling": "typename"58 },59 {60 "kind": "text",61 "spelling": " "62 },63 {64 "kind": "genericParameter",65 "spelling": "T"66 },67 {68 "kind": "text",69 "spelling": "> "70 },71 {72 "kind": "typeIdentifier",73 "preciseIdentifier": "c:t0.0",74 "spelling": "T"75 },76 {77 "kind": "text",78 "spelling": " "79 },80 {81 "kind": "identifier",82 "spelling": "Foo"83 },84 {85 "kind": "text",86 "spelling": ";"87 }88 ],89 "identifier": {90 "interfaceLanguage": "c++",91 "precise": "c:@Foo"92 },93 "kind": {94 "displayName": "Global Variable Template",95 "identifier": "c++.var"96 },97 "location": {98 "position": {99 "character": 23,100 "line": 0101 },102 "uri": "file://INPUT_DIR/input.h"103 },104 "names": {105 "navigator": [106 {107 "kind": "identifier",108 "spelling": "Foo"109 }110 ],111 "subHeading": [112 {113 "kind": "identifier",114 "spelling": "Foo"115 }116 ],117 "title": "Foo"118 },119 "pathComponents": [120 "Foo"121 ],122 "swiftGenerics": {123 "parameters": [124 {125 "depth": 0,126 "index": 0,127 "name": "T"128 }129 ]130 }131 }132 ]133}134