252 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.h14class Foo {15 operator int();16 explicit operator double();17};18/// expected-no-diagnostics19 20//--- reference.output.json.in21{22 "metadata": {23 "formatVersion": {24 "major": 0,25 "minor": 5,26 "patch": 327 },28 "generator": "?"29 },30 "module": {31 "name": "",32 "platform": {33 "architecture": "arm64",34 "operatingSystem": {35 "minimumVersion": {36 "major": 11,37 "minor": 0,38 "patch": 039 },40 "name": "macosx"41 },42 "vendor": "apple"43 }44 },45 "relationships": [46 {47 "kind": "memberOf",48 "source": "c:@S@Foo@F@operator int#",49 "target": "c:@S@Foo",50 "targetFallback": "Foo"51 },52 {53 "kind": "memberOf",54 "source": "c:@S@Foo@F@operator double#",55 "target": "c:@S@Foo",56 "targetFallback": "Foo"57 }58 ],59 "symbols": [60 {61 "accessLevel": "public",62 "declarationFragments": [63 {64 "kind": "keyword",65 "spelling": "class"66 },67 {68 "kind": "text",69 "spelling": " "70 },71 {72 "kind": "identifier",73 "spelling": "Foo"74 },75 {76 "kind": "text",77 "spelling": ";"78 }79 ],80 "identifier": {81 "interfaceLanguage": "c++",82 "precise": "c:@S@Foo"83 },84 "kind": {85 "displayName": "Class",86 "identifier": "c++.class"87 },88 "location": {89 "position": {90 "character": 6,91 "line": 092 },93 "uri": "file://INPUT_DIR/input.h"94 },95 "names": {96 "navigator": [97 {98 "kind": "identifier",99 "spelling": "Foo"100 }101 ],102 "subHeading": [103 {104 "kind": "identifier",105 "spelling": "Foo"106 }107 ],108 "title": "Foo"109 },110 "pathComponents": [111 "Foo"112 ]113 },114 {115 "accessLevel": "private",116 "declarationFragments": [117 {118 "kind": "keyword",119 "spelling": "operator"120 },121 {122 "kind": "text",123 "spelling": " "124 },125 {126 "kind": "typeIdentifier",127 "spelling": "int"128 },129 {130 "kind": "text",131 "spelling": "();"132 }133 ],134 "functionSignature": {135 "returns": [136 {137 "kind": "typeIdentifier",138 "preciseIdentifier": "c:I",139 "spelling": "int"140 }141 ]142 },143 "identifier": {144 "interfaceLanguage": "c++",145 "precise": "c:@S@Foo@F@operator int#"146 },147 "kind": {148 "displayName": "Instance Method",149 "identifier": "c++.method"150 },151 "location": {152 "position": {153 "character": 2,154 "line": 1155 },156 "uri": "file://INPUT_DIR/input.h"157 },158 "names": {159 "navigator": [160 {161 "kind": "identifier",162 "spelling": "operator int"163 }164 ],165 "subHeading": [166 {167 "kind": "identifier",168 "spelling": "int"169 }170 ],171 "title": "operator int"172 },173 "pathComponents": [174 "Foo",175 "operator int"176 ]177 },178 {179 "accessLevel": "private",180 "declarationFragments": [181 {182 "kind": "keyword",183 "spelling": "explicit"184 },185 {186 "kind": "text",187 "spelling": " "188 },189 {190 "kind": "keyword",191 "spelling": "operator"192 },193 {194 "kind": "text",195 "spelling": " "196 },197 {198 "kind": "typeIdentifier",199 "spelling": "double"200 },201 {202 "kind": "text",203 "spelling": "();"204 }205 ],206 "functionSignature": {207 "returns": [208 {209 "kind": "typeIdentifier",210 "preciseIdentifier": "c:d",211 "spelling": "double"212 }213 ]214 },215 "identifier": {216 "interfaceLanguage": "c++",217 "precise": "c:@S@Foo@F@operator double#"218 },219 "kind": {220 "displayName": "Instance Method",221 "identifier": "c++.method"222 },223 "location": {224 "position": {225 "character": 11,226 "line": 2227 },228 "uri": "file://INPUT_DIR/input.h"229 },230 "names": {231 "navigator": [232 {233 "kind": "identifier",234 "spelling": "operator double"235 }236 ],237 "subHeading": [238 {239 "kind": "identifier",240 "spelling": "double"241 }242 ],243 "title": "operator double"244 },245 "pathComponents": [246 "Foo",247 "operator double"248 ]249 }250 ]251}252