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