294 lines · cpp
1 2// RUN: rm -rf %t3// RUN: split-file %s %t4// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \5// RUN: %t/reference.output.json.in >> %t/reference.output.json6// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \7// RUN: -x c++-header %t/input.h -o %t/output.json -verify8 9// Generator version is not consistent across test runs, normalize it.10// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \11// RUN: %t/output.json >> %t/output-normalized.json12// RUN: diff %t/reference.output.json %t/output-normalized.json13 14//--- input.h15class Fizz {};16 17class Foo : public Fizz {};18 19class Bar : public Fizz {};20 21class FooBar : public Foo, public Bar{};22/// expected-no-diagnostics23 24//--- reference.output.json.in25{26 "metadata": {27 "formatVersion": {28 "major": 0,29 "minor": 5,30 "patch": 331 },32 "generator": "?"33 },34 "module": {35 "name": "",36 "platform": {37 "architecture": "arm64",38 "operatingSystem": {39 "minimumVersion": {40 "major": 11,41 "minor": 0,42 "patch": 043 },44 "name": "macosx"45 },46 "vendor": "apple"47 }48 },49 "relationships": [50 {51 "kind": "inheritsFrom",52 "source": "c:@S@Foo",53 "target": "c:@S@Fizz",54 "targetFallback": "Fizz"55 },56 {57 "kind": "inheritsFrom",58 "source": "c:@S@Bar",59 "target": "c:@S@Fizz",60 "targetFallback": "Fizz"61 },62 {63 "kind": "inheritsFrom",64 "source": "c:@S@FooBar",65 "target": "c:@S@Foo",66 "targetFallback": "Foo"67 },68 {69 "kind": "inheritsFrom",70 "source": "c:@S@FooBar",71 "target": "c:@S@Bar",72 "targetFallback": "Bar"73 }74 ],75 "symbols": [76 {77 "accessLevel": "public",78 "declarationFragments": [79 {80 "kind": "keyword",81 "spelling": "class"82 },83 {84 "kind": "text",85 "spelling": " "86 },87 {88 "kind": "identifier",89 "spelling": "Fizz"90 },91 {92 "kind": "text",93 "spelling": ";"94 }95 ],96 "identifier": {97 "interfaceLanguage": "c++",98 "precise": "c:@S@Fizz"99 },100 "kind": {101 "displayName": "Class",102 "identifier": "c++.class"103 },104 "location": {105 "position": {106 "character": 6,107 "line": 0108 },109 "uri": "file://INPUT_DIR/input.h"110 },111 "names": {112 "navigator": [113 {114 "kind": "identifier",115 "spelling": "Fizz"116 }117 ],118 "subHeading": [119 {120 "kind": "identifier",121 "spelling": "Fizz"122 }123 ],124 "title": "Fizz"125 },126 "pathComponents": [127 "Fizz"128 ]129 },130 {131 "accessLevel": "public",132 "declarationFragments": [133 {134 "kind": "keyword",135 "spelling": "class"136 },137 {138 "kind": "text",139 "spelling": " "140 },141 {142 "kind": "identifier",143 "spelling": "Foo"144 },145 {146 "kind": "text",147 "spelling": ";"148 }149 ],150 "identifier": {151 "interfaceLanguage": "c++",152 "precise": "c:@S@Foo"153 },154 "kind": {155 "displayName": "Class",156 "identifier": "c++.class"157 },158 "location": {159 "position": {160 "character": 6,161 "line": 2162 },163 "uri": "file://INPUT_DIR/input.h"164 },165 "names": {166 "navigator": [167 {168 "kind": "identifier",169 "spelling": "Foo"170 }171 ],172 "subHeading": [173 {174 "kind": "identifier",175 "spelling": "Foo"176 }177 ],178 "title": "Foo"179 },180 "pathComponents": [181 "Foo"182 ]183 },184 {185 "accessLevel": "public",186 "declarationFragments": [187 {188 "kind": "keyword",189 "spelling": "class"190 },191 {192 "kind": "text",193 "spelling": " "194 },195 {196 "kind": "identifier",197 "spelling": "Bar"198 },199 {200 "kind": "text",201 "spelling": ";"202 }203 ],204 "identifier": {205 "interfaceLanguage": "c++",206 "precise": "c:@S@Bar"207 },208 "kind": {209 "displayName": "Class",210 "identifier": "c++.class"211 },212 "location": {213 "position": {214 "character": 6,215 "line": 4216 },217 "uri": "file://INPUT_DIR/input.h"218 },219 "names": {220 "navigator": [221 {222 "kind": "identifier",223 "spelling": "Bar"224 }225 ],226 "subHeading": [227 {228 "kind": "identifier",229 "spelling": "Bar"230 }231 ],232 "title": "Bar"233 },234 "pathComponents": [235 "Bar"236 ]237 },238 {239 "accessLevel": "public",240 "declarationFragments": [241 {242 "kind": "keyword",243 "spelling": "class"244 },245 {246 "kind": "text",247 "spelling": " "248 },249 {250 "kind": "identifier",251 "spelling": "FooBar"252 },253 {254 "kind": "text",255 "spelling": ";"256 }257 ],258 "identifier": {259 "interfaceLanguage": "c++",260 "precise": "c:@S@FooBar"261 },262 "kind": {263 "displayName": "Class",264 "identifier": "c++.class"265 },266 "location": {267 "position": {268 "character": 6,269 "line": 6270 },271 "uri": "file://INPUT_DIR/input.h"272 },273 "names": {274 "navigator": [275 {276 "kind": "identifier",277 "spelling": "FooBar"278 }279 ],280 "subHeading": [281 {282 "kind": "identifier",283 "spelling": "FooBar"284 }285 ],286 "title": "FooBar"287 },288 "pathComponents": [289 "FooBar"290 ]291 }292 ]293}294