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 class Foo { 15 int operator+(int x); 16 }; 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 { 46 "kind": "memberOf", 47 "source": "c:@S@Foo@F@operator+#I#", 48 "target": "c:@S@Foo", 49 "targetFallback": "Foo" 50 } 51 ], 52 "symbols": [ 53 { 54 "accessLevel": "public", 55 "declarationFragments": [ 56 { 57 "kind": "keyword", 58 "spelling": "class" 59 }, 60 { 61 "kind": "text", 62 "spelling": " " 63 }, 64 { 65 "kind": "identifier", 66 "spelling": "Foo" 67 }, 68 { 69 "kind": "text", 70 "spelling": ";" 71 } 72 ], 73 "identifier": { 74 "interfaceLanguage": "c++", 75 "precise": "c:@S@Foo" 76 }, 77 "kind": { 78 "displayName": "Class", 79 "identifier": "c++.class" 80 }, 81 "location": { 82 "position": { 83 "character": 6, 84 "line": 0 85 }, 86 "uri": "file://INPUT_DIR/input.h" 87 }, 88 "names": { 89 "navigator": [ 90 { 91 "kind": "identifier", 92 "spelling": "Foo" 93 } 94 ], 95 "subHeading": [ 96 { 97 "kind": "identifier", 98 "spelling": "Foo" 99 } 100 ], 101 "title": "Foo" 102 }, 103 "pathComponents": [ 104 "Foo" 105 ] 106 }, 107 { 108 "accessLevel": "private", 109 "declarationFragments": [ 110 { 111 "kind": "typeIdentifier", 112 "preciseIdentifier": "c:I", 113 "spelling": "int" 114 }, 115 { 116 "kind": "text", 117 "spelling": " " 118 }, 119 { 120 "kind": "identifier", 121 "spelling": "operator+" 122 }, 123 { 124 "kind": "text", 125 "spelling": "(" 126 }, 127 { 128 "kind": "typeIdentifier", 129 "preciseIdentifier": "c:I", 130 "spelling": "int" 131 }, 132 { 133 "kind": "text", 134 "spelling": " " 135 }, 136 { 137 "kind": "internalParam", 138 "spelling": "x" 139 }, 140 { 141 "kind": "text", 142 "spelling": ");" 143 } 144 ], 145 "functionSignature": { 146 "parameters": [ 147 { 148 "declarationFragments": [ 149 { 150 "kind": "typeIdentifier", 151 "preciseIdentifier": "c:I", 152 "spelling": "int" 153 }, 154 { 155 "kind": "text", 156 "spelling": " " 157 }, 158 { 159 "kind": "internalParam", 160 "spelling": "x" 161 } 162 ], 163 "name": "x" 164 } 165 ], 166 "returns": [ 167 { 168 "kind": "typeIdentifier", 169 "preciseIdentifier": "c:I", 170 "spelling": "int" 171 } 172 ] 173 }, 174 "identifier": { 175 "interfaceLanguage": "c++", 176 "precise": "c:@S@Foo@F@operator+#I#" 177 }, 178 "kind": { 179 "displayName": "Instance Method", 180 "identifier": "c++.method" 181 }, 182 "location": { 183 "position": { 184 "character": 6, 185 "line": 1 186 }, 187 "uri": "file://INPUT_DIR/input.h" 188 }, 189 "names": { 190 "navigator": [ 191 { 192 "kind": "identifier", 193 "spelling": "operator+" 194 } 195 ], 196 "subHeading": [ 197 { 198 "kind": "identifier", 199 "spelling": "operator+" 200 } 201 ], 202 "title": "operator+" 203 }, 204 "pathComponents": [ 205 "Foo", 206 "operator+" 207 ] 208 } 209 ] 210 } 211