1 // RUN: rm -rf %t 2 // RUN: split-file %s %t 3 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \ 4 // RUN: %t/reference.output.json.in >> %t/reference.output.json 5 // RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \ 6 // RUN: -x c++-header %t/input.h -o %t/output.json -verify 7 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.json 11 // RUN: diff %t/reference.output.json %t/output-normalized.json 12 13 //--- input.h 14 template<typename T> T Foo = T(3.14); 15 16 template<> int Foo<int>; 17 /// expected-no-diagnostics 18 19 //--- reference.output.json.in 20 { 21 "metadata": { 22 "formatVersion": { 23 "major": 0, 24 "minor": 5, 25 "patch": 3 26 }, 27 "generator": "?" 28 }, 29 "module": { 30 "name": "", 31 "platform": { 32 "architecture": "arm64", 33 "operatingSystem": { 34 "minimumVersion": { 35 "major": 11, 36 "minor": 0, 37 "patch": 0 38 }, 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": "T" 68 }, 69 { 70 "kind": "text", 71 "spelling": "> " 72 }, 73 { 74 "kind": "typeIdentifier", 75 "preciseIdentifier": "c:t0.0", 76 "spelling": "T" 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:@Foo" 94 }, 95 "kind": { 96 "displayName": "Global Variable Template", 97 "identifier": "c++.var" 98 }, 99 "location": { 100 "position": { 101 "character": 23, 102 "line": 0 103 }, 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": "typeIdentifier", 147 "preciseIdentifier": "c:I", 148 "spelling": "int" 149 }, 150 { 151 "kind": "text", 152 "spelling": " " 153 }, 154 { 155 "kind": "identifier", 156 "spelling": "Foo" 157 }, 158 { 159 "kind": "text", 160 "spelling": "<" 161 }, 162 { 163 "kind": "typeIdentifier", 164 "preciseIdentifier": "c:I", 165 "spelling": "int" 166 }, 167 { 168 "kind": "text", 169 "spelling": ">;" 170 } 171 ], 172 "identifier": { 173 "interfaceLanguage": "c++", 174 "precise": "c:@Foo>#I" 175 }, 176 "kind": { 177 "displayName": "Global Variable Template Specialization", 178 "identifier": "c++.var" 179 }, 180 "location": { 181 "position": { 182 "character": 15, 183 "line": 2 184 }, 185 "uri": "file://INPUT_DIR/input.h" 186 }, 187 "names": { 188 "navigator": [ 189 { 190 "kind": "identifier", 191 "spelling": "Foo" 192 } 193 ], 194 "subHeading": [ 195 { 196 "kind": "identifier", 197 "spelling": "Foo" 198 } 199 ], 200 "title": "Foo" 201 }, 202 "pathComponents": [ 203 "Foo" 204 ] 205 } 206 ] 207 } 208