175f55eb3SErick Velez // RUN: rm -rf %t 275f55eb3SErick Velez // RUN: split-file %s %t 375f55eb3SErick Velez // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \ 475f55eb3SErick Velez // RUN: %t/reference.output.json.in >> %t/reference.output.json 5*e05c1b46SDaniel Grumberg // RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \ 675f55eb3SErick Velez // RUN: -x c++-header %t/input.h -o %t/output.json -verify 775f55eb3SErick Velez 875f55eb3SErick Velez // Generator version is not consistent across test runs, normalize it. 975f55eb3SErick Velez // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \ 1075f55eb3SErick Velez // RUN: %t/output.json >> %t/output-normalized.json 1175f55eb3SErick Velez // RUN: diff %t/reference.output.json %t/output-normalized.json 1275f55eb3SErick Velez 1375f55eb3SErick Velez //--- input.h 1475f55eb3SErick Velez class Foo { 1575f55eb3SErick Velez operator int(); 1675f55eb3SErick Velez explicit operator double(); 1775f55eb3SErick Velez }; 1875f55eb3SErick Velez /// expected-no-diagnostics 1975f55eb3SErick Velez 2075f55eb3SErick Velez //--- reference.output.json.in 2175f55eb3SErick Velez { 2275f55eb3SErick Velez "metadata": { 2375f55eb3SErick Velez "formatVersion": { 2475f55eb3SErick Velez "major": 0, 2575f55eb3SErick Velez "minor": 5, 2675f55eb3SErick Velez "patch": 3 2775f55eb3SErick Velez }, 2875f55eb3SErick Velez "generator": "?" 2975f55eb3SErick Velez }, 3075f55eb3SErick Velez "module": { 3175f55eb3SErick Velez "name": "", 3275f55eb3SErick Velez "platform": { 3375f55eb3SErick Velez "architecture": "arm64", 3475f55eb3SErick Velez "operatingSystem": { 3575f55eb3SErick Velez "minimumVersion": { 3675f55eb3SErick Velez "major": 11, 3775f55eb3SErick Velez "minor": 0, 3875f55eb3SErick Velez "patch": 0 3975f55eb3SErick Velez }, 4075f55eb3SErick Velez "name": "macosx" 4175f55eb3SErick Velez }, 4275f55eb3SErick Velez "vendor": "apple" 4375f55eb3SErick Velez } 4475f55eb3SErick Velez }, 4575f55eb3SErick Velez "relationships": [ 4675f55eb3SErick Velez { 4775f55eb3SErick Velez "kind": "memberOf", 4875f55eb3SErick Velez "source": "c:@S@Foo@F@operator int#", 4975f55eb3SErick Velez "target": "c:@S@Foo", 5075f55eb3SErick Velez "targetFallback": "Foo" 5175f55eb3SErick Velez }, 5275f55eb3SErick Velez { 5375f55eb3SErick Velez "kind": "memberOf", 5475f55eb3SErick Velez "source": "c:@S@Foo@F@operator double#", 5575f55eb3SErick Velez "target": "c:@S@Foo", 5675f55eb3SErick Velez "targetFallback": "Foo" 5775f55eb3SErick Velez } 5875f55eb3SErick Velez ], 5975f55eb3SErick Velez "symbols": [ 6075f55eb3SErick Velez { 6175f55eb3SErick Velez "accessLevel": "public", 6275f55eb3SErick Velez "declarationFragments": [ 6375f55eb3SErick Velez { 6475f55eb3SErick Velez "kind": "keyword", 6575f55eb3SErick Velez "spelling": "class" 6675f55eb3SErick Velez }, 6775f55eb3SErick Velez { 6875f55eb3SErick Velez "kind": "text", 6975f55eb3SErick Velez "spelling": " " 7075f55eb3SErick Velez }, 7175f55eb3SErick Velez { 7275f55eb3SErick Velez "kind": "identifier", 7375f55eb3SErick Velez "spelling": "Foo" 7475f55eb3SErick Velez }, 7575f55eb3SErick Velez { 7675f55eb3SErick Velez "kind": "text", 7775f55eb3SErick Velez "spelling": ";" 7875f55eb3SErick Velez } 7975f55eb3SErick Velez ], 8075f55eb3SErick Velez "identifier": { 8175f55eb3SErick Velez "interfaceLanguage": "c++", 8275f55eb3SErick Velez "precise": "c:@S@Foo" 8375f55eb3SErick Velez }, 8475f55eb3SErick Velez "kind": { 8575f55eb3SErick Velez "displayName": "Class", 8675f55eb3SErick Velez "identifier": "c++.class" 8775f55eb3SErick Velez }, 8875f55eb3SErick Velez "location": { 8975f55eb3SErick Velez "position": { 9063537872SQuietMisdreavus "character": 6, 9163537872SQuietMisdreavus "line": 0 9275f55eb3SErick Velez }, 9375f55eb3SErick Velez "uri": "file://INPUT_DIR/input.h" 9475f55eb3SErick Velez }, 9575f55eb3SErick Velez "names": { 9675f55eb3SErick Velez "navigator": [ 9775f55eb3SErick Velez { 9875f55eb3SErick Velez "kind": "identifier", 9975f55eb3SErick Velez "spelling": "Foo" 10075f55eb3SErick Velez } 10175f55eb3SErick Velez ], 10275f55eb3SErick Velez "subHeading": [ 10375f55eb3SErick Velez { 10475f55eb3SErick Velez "kind": "identifier", 10575f55eb3SErick Velez "spelling": "Foo" 10675f55eb3SErick Velez } 10775f55eb3SErick Velez ], 10875f55eb3SErick Velez "title": "Foo" 10975f55eb3SErick Velez }, 11075f55eb3SErick Velez "pathComponents": [ 11175f55eb3SErick Velez "Foo" 11275f55eb3SErick Velez ] 11375f55eb3SErick Velez }, 11475f55eb3SErick Velez { 11575f55eb3SErick Velez "accessLevel": "private", 11675f55eb3SErick Velez "declarationFragments": [ 11775f55eb3SErick Velez { 11875f55eb3SErick Velez "kind": "keyword", 11975f55eb3SErick Velez "spelling": "operator" 12075f55eb3SErick Velez }, 12175f55eb3SErick Velez { 12275f55eb3SErick Velez "kind": "text", 12375f55eb3SErick Velez "spelling": " " 12475f55eb3SErick Velez }, 12575f55eb3SErick Velez { 12675f55eb3SErick Velez "kind": "typeIdentifier", 12775f55eb3SErick Velez "spelling": "int" 12875f55eb3SErick Velez }, 12975f55eb3SErick Velez { 13075f55eb3SErick Velez "kind": "text", 13175f55eb3SErick Velez "spelling": "();" 13275f55eb3SErick Velez } 13375f55eb3SErick Velez ], 13475f55eb3SErick Velez "functionSignature": { 13575f55eb3SErick Velez "returns": [ 13675f55eb3SErick Velez { 13775f55eb3SErick Velez "kind": "typeIdentifier", 13875f55eb3SErick Velez "preciseIdentifier": "c:I", 13975f55eb3SErick Velez "spelling": "int" 14075f55eb3SErick Velez } 14175f55eb3SErick Velez ] 14275f55eb3SErick Velez }, 14375f55eb3SErick Velez "identifier": { 14475f55eb3SErick Velez "interfaceLanguage": "c++", 14575f55eb3SErick Velez "precise": "c:@S@Foo@F@operator int#" 14675f55eb3SErick Velez }, 14775f55eb3SErick Velez "kind": { 14875f55eb3SErick Velez "displayName": "Instance Method", 14975f55eb3SErick Velez "identifier": "c++.method" 15075f55eb3SErick Velez }, 15175f55eb3SErick Velez "location": { 15275f55eb3SErick Velez "position": { 15363537872SQuietMisdreavus "character": 2, 15463537872SQuietMisdreavus "line": 1 15575f55eb3SErick Velez }, 15675f55eb3SErick Velez "uri": "file://INPUT_DIR/input.h" 15775f55eb3SErick Velez }, 15875f55eb3SErick Velez "names": { 15975f55eb3SErick Velez "navigator": [ 16075f55eb3SErick Velez { 16175f55eb3SErick Velez "kind": "identifier", 16275f55eb3SErick Velez "spelling": "operator int" 16375f55eb3SErick Velez } 16475f55eb3SErick Velez ], 16575f55eb3SErick Velez "subHeading": [ 16675f55eb3SErick Velez { 16775f55eb3SErick Velez "kind": "identifier", 16875f55eb3SErick Velez "spelling": "int" 16975f55eb3SErick Velez } 17075f55eb3SErick Velez ], 17175f55eb3SErick Velez "title": "operator int" 17275f55eb3SErick Velez }, 17375f55eb3SErick Velez "pathComponents": [ 17475f55eb3SErick Velez "Foo", 17575f55eb3SErick Velez "operator int" 17675f55eb3SErick Velez ] 17775f55eb3SErick Velez }, 17875f55eb3SErick Velez { 17975f55eb3SErick Velez "accessLevel": "private", 18075f55eb3SErick Velez "declarationFragments": [ 18175f55eb3SErick Velez { 18275f55eb3SErick Velez "kind": "keyword", 18375f55eb3SErick Velez "spelling": "explicit" 18475f55eb3SErick Velez }, 18575f55eb3SErick Velez { 18675f55eb3SErick Velez "kind": "text", 18775f55eb3SErick Velez "spelling": " " 18875f55eb3SErick Velez }, 18975f55eb3SErick Velez { 19075f55eb3SErick Velez "kind": "keyword", 19175f55eb3SErick Velez "spelling": "operator" 19275f55eb3SErick Velez }, 19375f55eb3SErick Velez { 19475f55eb3SErick Velez "kind": "text", 19575f55eb3SErick Velez "spelling": " " 19675f55eb3SErick Velez }, 19775f55eb3SErick Velez { 19875f55eb3SErick Velez "kind": "typeIdentifier", 19975f55eb3SErick Velez "spelling": "double" 20075f55eb3SErick Velez }, 20175f55eb3SErick Velez { 20275f55eb3SErick Velez "kind": "text", 20375f55eb3SErick Velez "spelling": "();" 20475f55eb3SErick Velez } 20575f55eb3SErick Velez ], 20675f55eb3SErick Velez "functionSignature": { 20775f55eb3SErick Velez "returns": [ 20875f55eb3SErick Velez { 20975f55eb3SErick Velez "kind": "typeIdentifier", 21075f55eb3SErick Velez "preciseIdentifier": "c:d", 21175f55eb3SErick Velez "spelling": "double" 21275f55eb3SErick Velez } 21375f55eb3SErick Velez ] 21475f55eb3SErick Velez }, 21575f55eb3SErick Velez "identifier": { 21675f55eb3SErick Velez "interfaceLanguage": "c++", 21775f55eb3SErick Velez "precise": "c:@S@Foo@F@operator double#" 21875f55eb3SErick Velez }, 21975f55eb3SErick Velez "kind": { 22075f55eb3SErick Velez "displayName": "Instance Method", 22175f55eb3SErick Velez "identifier": "c++.method" 22275f55eb3SErick Velez }, 22375f55eb3SErick Velez "location": { 22475f55eb3SErick Velez "position": { 22563537872SQuietMisdreavus "character": 11, 22663537872SQuietMisdreavus "line": 2 22775f55eb3SErick Velez }, 22875f55eb3SErick Velez "uri": "file://INPUT_DIR/input.h" 22975f55eb3SErick Velez }, 23075f55eb3SErick Velez "names": { 23175f55eb3SErick Velez "navigator": [ 23275f55eb3SErick Velez { 23375f55eb3SErick Velez "kind": "identifier", 23475f55eb3SErick Velez "spelling": "operator double" 23575f55eb3SErick Velez } 23675f55eb3SErick Velez ], 23775f55eb3SErick Velez "subHeading": [ 23875f55eb3SErick Velez { 23975f55eb3SErick Velez "kind": "identifier", 24075f55eb3SErick Velez "spelling": "double" 24175f55eb3SErick Velez } 24275f55eb3SErick Velez ], 24375f55eb3SErick Velez "title": "operator double" 24475f55eb3SErick Velez }, 24575f55eb3SErick Velez "pathComponents": [ 24675f55eb3SErick Velez "Foo", 24775f55eb3SErick Velez "operator double" 24875f55eb3SErick Velez ] 24975f55eb3SErick Velez } 25075f55eb3SErick Velez ] 25175f55eb3SErick Velez } 252