228 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 Foo();16 ~Foo();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@Foo#",49 "target": "c:@S@Foo",50 "targetFallback": "Foo"51 },52 {53 "kind": "memberOf",54 "source": "c:@S@Foo@F@~Foo#",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": "identifier",119 "spelling": "Foo"120 },121 {122 "kind": "text",123 "spelling": "();"124 }125 ],126 "functionSignature": {127 "returns": [128 {129 "kind": "typeIdentifier",130 "preciseIdentifier": "c:v",131 "spelling": "void"132 }133 ]134 },135 "identifier": {136 "interfaceLanguage": "c++",137 "precise": "c:@S@Foo@F@Foo#"138 },139 "kind": {140 "displayName": "Constructor",141 "identifier": "c++.method"142 },143 "location": {144 "position": {145 "character": 2,146 "line": 1147 },148 "uri": "file://INPUT_DIR/input.h"149 },150 "names": {151 "navigator": [152 {153 "kind": "identifier",154 "spelling": "Foo"155 }156 ],157 "subHeading": [158 {159 "kind": "identifier",160 "spelling": "Foo"161 }162 ],163 "title": "Foo"164 },165 "pathComponents": [166 "Foo",167 "Foo"168 ]169 },170 {171 "accessLevel": "private",172 "declarationFragments": [173 {174 "kind": "identifier",175 "spelling": "~Foo"176 },177 {178 "kind": "text",179 "spelling": "();"180 }181 ],182 "functionSignature": {183 "returns": [184 {185 "kind": "typeIdentifier",186 "preciseIdentifier": "c:v",187 "spelling": "void"188 }189 ]190 },191 "identifier": {192 "interfaceLanguage": "c++",193 "precise": "c:@S@Foo@F@~Foo#"194 },195 "kind": {196 "displayName": "Destructor",197 "identifier": "c++.method"198 },199 "location": {200 "position": {201 "character": 2,202 "line": 2203 },204 "uri": "file://INPUT_DIR/input.h"205 },206 "names": {207 "navigator": [208 {209 "kind": "identifier",210 "spelling": "~Foo"211 }212 ],213 "subHeading": [214 {215 "kind": "identifier",216 "spelling": "~Foo"217 }218 ],219 "title": "~Foo"220 },221 "pathComponents": [222 "Foo",223 "~Foo"224 ]225 }226 ]227}228