1 // RUN: rm -rf %t 2 // RUN: split-file %s %t 3 // RUN: sed -e "s@INPUT_DIR@%/t@g" %t/reference.output.json.in >> \ 4 // RUN: %t/reference.output.json 5 // RUN: %clang -extract-api --product-name=Macros -target arm64-apple-macosx \ 6 // RUN: -x objective-c-header %t/input.h -o %t/output.json | FileCheck -allow-empty %s 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 // CHECK-NOT: error: 14 // CHECK-NOT: warning: 15 16 //--- input.h 17 #define HELLO 1 18 #define WORLD 2 19 #define MACRO_FUN(x) x x 20 #define FUN(x, y, z) x + y + z 21 #define FUNC99(x, ...) 22 #define FUNGNU(x...) 23 24 //--- reference.output.json.in 25 { 26 "metadata": { 27 "formatVersion": { 28 "major": 0, 29 "minor": 5, 30 "patch": 3 31 }, 32 "generator": "?" 33 }, 34 "module": { 35 "name": "Macros", 36 "platform": { 37 "architecture": "arm64", 38 "operatingSystem": { 39 "minimumVersion": { 40 "major": 11, 41 "minor": 0, 42 "patch": 0 43 }, 44 "name": "macosx" 45 }, 46 "vendor": "apple" 47 } 48 }, 49 "relationhips": [], 50 "symbols": [ 51 { 52 "declarationFragments": [ 53 { 54 "kind": "keyword", 55 "spelling": "#define" 56 }, 57 { 58 "kind": "text", 59 "spelling": " " 60 }, 61 { 62 "kind": "identifier", 63 "spelling": "HELLO" 64 } 65 ], 66 "identifier": { 67 "interfaceLanguage": "objective-c", 68 "precise": "c:input.h@8@macro@HELLO" 69 }, 70 "kind": { 71 "displayName": "Macro", 72 "identifier": "objective-c.macro" 73 }, 74 "location": { 75 "character": 9, 76 "line": 1, 77 "uri": "file://INPUT_DIR/input.h" 78 }, 79 "names": { 80 "subHeading": [ 81 { 82 "kind": "identifier", 83 "spelling": "HELLO" 84 } 85 ], 86 "title": "HELLO" 87 } 88 }, 89 { 90 "declarationFragments": [ 91 { 92 "kind": "keyword", 93 "spelling": "#define" 94 }, 95 { 96 "kind": "text", 97 "spelling": " " 98 }, 99 { 100 "kind": "identifier", 101 "spelling": "WORLD" 102 } 103 ], 104 "identifier": { 105 "interfaceLanguage": "objective-c", 106 "precise": "c:input.h@24@macro@WORLD" 107 }, 108 "kind": { 109 "displayName": "Macro", 110 "identifier": "objective-c.macro" 111 }, 112 "location": { 113 "character": 9, 114 "line": 2, 115 "uri": "file://INPUT_DIR/input.h" 116 }, 117 "names": { 118 "subHeading": [ 119 { 120 "kind": "identifier", 121 "spelling": "WORLD" 122 } 123 ], 124 "title": "WORLD" 125 } 126 }, 127 { 128 "declarationFragments": [ 129 { 130 "kind": "keyword", 131 "spelling": "#define" 132 }, 133 { 134 "kind": "text", 135 "spelling": " " 136 }, 137 { 138 "kind": "identifier", 139 "spelling": "MACRO_FUN" 140 }, 141 { 142 "kind": "text", 143 "spelling": "(" 144 }, 145 { 146 "kind": "internalParam", 147 "spelling": "x" 148 }, 149 { 150 "kind": "text", 151 "spelling": ")" 152 } 153 ], 154 "identifier": { 155 "interfaceLanguage": "objective-c", 156 "precise": "c:input.h@40@macro@MACRO_FUN" 157 }, 158 "kind": { 159 "displayName": "Macro", 160 "identifier": "objective-c.macro" 161 }, 162 "location": { 163 "character": 9, 164 "line": 3, 165 "uri": "file://INPUT_DIR/input.h" 166 }, 167 "names": { 168 "subHeading": [ 169 { 170 "kind": "identifier", 171 "spelling": "MACRO_FUN" 172 } 173 ], 174 "title": "MACRO_FUN" 175 } 176 }, 177 { 178 "declarationFragments": [ 179 { 180 "kind": "keyword", 181 "spelling": "#define" 182 }, 183 { 184 "kind": "text", 185 "spelling": " " 186 }, 187 { 188 "kind": "identifier", 189 "spelling": "FUN" 190 }, 191 { 192 "kind": "text", 193 "spelling": "(" 194 }, 195 { 196 "kind": "internalParam", 197 "spelling": "x" 198 }, 199 { 200 "kind": "text", 201 "spelling": ", " 202 }, 203 { 204 "kind": "internalParam", 205 "spelling": "y" 206 }, 207 { 208 "kind": "text", 209 "spelling": ", " 210 }, 211 { 212 "kind": "internalParam", 213 "spelling": "z" 214 }, 215 { 216 "kind": "text", 217 "spelling": ")" 218 } 219 ], 220 "identifier": { 221 "interfaceLanguage": "objective-c", 222 "precise": "c:input.h@65@macro@FUN" 223 }, 224 "kind": { 225 "displayName": "Macro", 226 "identifier": "objective-c.macro" 227 }, 228 "location": { 229 "character": 9, 230 "line": 4, 231 "uri": "file://INPUT_DIR/input.h" 232 }, 233 "names": { 234 "subHeading": [ 235 { 236 "kind": "identifier", 237 "spelling": "FUN" 238 } 239 ], 240 "title": "FUN" 241 } 242 }, 243 { 244 "declarationFragments": [ 245 { 246 "kind": "keyword", 247 "spelling": "#define" 248 }, 249 { 250 "kind": "text", 251 "spelling": " " 252 }, 253 { 254 "kind": "identifier", 255 "spelling": "FUNC99" 256 }, 257 { 258 "kind": "text", 259 "spelling": "(" 260 }, 261 { 262 "kind": "internalParam", 263 "spelling": "x" 264 }, 265 { 266 "kind": "text", 267 "spelling": ", ...)" 268 } 269 ], 270 "identifier": { 271 "interfaceLanguage": "objective-c", 272 "precise": "c:input.h@96@macro@FUNC99" 273 }, 274 "kind": { 275 "displayName": "Macro", 276 "identifier": "objective-c.macro" 277 }, 278 "location": { 279 "character": 9, 280 "line": 5, 281 "uri": "file://INPUT_DIR/input.h" 282 }, 283 "names": { 284 "subHeading": [ 285 { 286 "kind": "identifier", 287 "spelling": "FUNC99" 288 } 289 ], 290 "title": "FUNC99" 291 } 292 }, 293 { 294 "declarationFragments": [ 295 { 296 "kind": "keyword", 297 "spelling": "#define" 298 }, 299 { 300 "kind": "text", 301 "spelling": " " 302 }, 303 { 304 "kind": "identifier", 305 "spelling": "FUNGNU" 306 }, 307 { 308 "kind": "text", 309 "spelling": "(" 310 }, 311 { 312 "kind": "internalParam", 313 "spelling": "x" 314 }, 315 { 316 "kind": "text", 317 "spelling": "...)" 318 } 319 ], 320 "identifier": { 321 "interfaceLanguage": "objective-c", 322 "precise": "c:input.h@119@macro@FUNGNU" 323 }, 324 "kind": { 325 "displayName": "Macro", 326 "identifier": "objective-c.macro" 327 }, 328 "location": { 329 "character": 9, 330 "line": 6, 331 "uri": "file://INPUT_DIR/input.h" 332 }, 333 "names": { 334 "subHeading": [ 335 { 336 "kind": "identifier", 337 "spelling": "FUNGNU" 338 } 339 ], 340 "title": "FUNGNU" 341 } 342 } 343 ] 344 } 345