1 // RUN: rm -rf %t 2 // RUN: split-file %s %t 3 // RUN: sed -e "s@INPUT_DIR@%/t@g" %t/c.reference.output.json.in >> \ 4 // RUN: %t/c.reference.output.json 5 // RUN: sed -e "s@INPUT_DIR@%/t@g" %t/objc.reference.output.json.in >> \ 6 // RUN: %t/objc.reference.output.json 7 8 // RUN: %clang -extract-api -x c-header -target arm64-apple-macosx \ 9 // RUN: %t/c.h -o %t/c.output.json | FileCheck -allow-empty %s 10 // RUN: %clang -extract-api -x objective-c-header -target arm64-apple-macosx \ 11 // RUN: %t/objc.h -o %t/objc.output.json | FileCheck -allow-empty %s 12 13 // Generator version is not consistent across test runs, normalize it. 14 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \ 15 // RUN: %t/c.output.json >> %t/c.output-normalized.json 16 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \ 17 // RUN: %t/objc.output.json >> %t/objc.output-normalized.json 18 19 // RUN: diff %t/c.reference.output.json %t/c.output-normalized.json 20 // RUN: diff %t/objc.reference.output.json %t/objc.output-normalized.json 21 22 // CHECK-NOT: error: 23 // CHECK-NOT: warning: 24 25 //--- c.h 26 char c; 27 28 //--- objc.h 29 char objc; 30 31 //--- c.reference.output.json.in 32 { 33 "metadata": { 34 "formatVersion": { 35 "major": 0, 36 "minor": 5, 37 "patch": 3 38 }, 39 "generator": "?" 40 }, 41 "module": { 42 "name": "", 43 "platform": { 44 "architecture": "arm64", 45 "operatingSystem": { 46 "minimumVersion": { 47 "major": 11, 48 "minor": 0, 49 "patch": 0 50 }, 51 "name": "macosx" 52 }, 53 "vendor": "apple" 54 } 55 }, 56 "relationships": [], 57 "symbols": [ 58 { 59 "accessLevel": "public", 60 "declarationFragments": [ 61 { 62 "kind": "typeIdentifier", 63 "preciseIdentifier": "c:C", 64 "spelling": "char" 65 }, 66 { 67 "kind": "text", 68 "spelling": " " 69 }, 70 { 71 "kind": "identifier", 72 "spelling": "c" 73 } 74 ], 75 "identifier": { 76 "interfaceLanguage": "c", 77 "precise": "c:@c" 78 }, 79 "kind": { 80 "displayName": "Global Variable", 81 "identifier": "c.var" 82 }, 83 "location": { 84 "position": { 85 "character": 6, 86 "line": 1 87 }, 88 "uri": "file://INPUT_DIR/c.h" 89 }, 90 "names": { 91 "subHeading": [ 92 { 93 "kind": "identifier", 94 "spelling": "c" 95 } 96 ], 97 "title": "c" 98 }, 99 "pathComponents": [ 100 "c" 101 ] 102 } 103 ] 104 } 105 //--- objc.reference.output.json.in 106 { 107 "metadata": { 108 "formatVersion": { 109 "major": 0, 110 "minor": 5, 111 "patch": 3 112 }, 113 "generator": "?" 114 }, 115 "module": { 116 "name": "", 117 "platform": { 118 "architecture": "arm64", 119 "operatingSystem": { 120 "minimumVersion": { 121 "major": 11, 122 "minor": 0, 123 "patch": 0 124 }, 125 "name": "macosx" 126 }, 127 "vendor": "apple" 128 } 129 }, 130 "relationships": [], 131 "symbols": [ 132 { 133 "accessLevel": "public", 134 "declarationFragments": [ 135 { 136 "kind": "typeIdentifier", 137 "preciseIdentifier": "c:C", 138 "spelling": "char" 139 }, 140 { 141 "kind": "text", 142 "spelling": " " 143 }, 144 { 145 "kind": "identifier", 146 "spelling": "objc" 147 } 148 ], 149 "identifier": { 150 "interfaceLanguage": "objective-c", 151 "precise": "c:@objc" 152 }, 153 "kind": { 154 "displayName": "Global Variable", 155 "identifier": "objective-c.var" 156 }, 157 "location": { 158 "position": { 159 "character": 6, 160 "line": 1 161 }, 162 "uri": "file://INPUT_DIR/objc.h" 163 }, 164 "names": { 165 "subHeading": [ 166 { 167 "kind": "identifier", 168 "spelling": "objc" 169 } 170 ], 171 "title": "objc" 172 }, 173 "pathComponents": [ 174 "objc" 175 ] 176 } 177 ] 178 } 179