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 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 "navigator": [ 92 { 93 "kind": "identifier", 94 "spelling": "c" 95 } 96 ], 97 "subHeading": [ 98 { 99 "kind": "identifier", 100 "spelling": "c" 101 } 102 ], 103 "title": "c" 104 }, 105 "pathComponents": [ 106 "c" 107 ] 108 } 109 ] 110 } 111 //--- objc.reference.output.json.in 112 { 113 "metadata": { 114 "formatVersion": { 115 "major": 0, 116 "minor": 5, 117 "patch": 3 118 }, 119 "generator": "?" 120 }, 121 "module": { 122 "name": "", 123 "platform": { 124 "architecture": "arm64", 125 "operatingSystem": { 126 "minimumVersion": { 127 "major": 11, 128 "minor": 0, 129 "patch": 0 130 }, 131 "name": "macosx" 132 }, 133 "vendor": "apple" 134 } 135 }, 136 "relationships": [], 137 "symbols": [ 138 { 139 "accessLevel": "public", 140 "declarationFragments": [ 141 { 142 "kind": "typeIdentifier", 143 "preciseIdentifier": "c:C", 144 "spelling": "char" 145 }, 146 { 147 "kind": "text", 148 "spelling": " " 149 }, 150 { 151 "kind": "identifier", 152 "spelling": "objc" 153 } 154 ], 155 "identifier": { 156 "interfaceLanguage": "objective-c", 157 "precise": "c:@objc" 158 }, 159 "kind": { 160 "displayName": "Global Variable", 161 "identifier": "objective-c.var" 162 }, 163 "location": { 164 "position": { 165 "character": 6, 166 "line": 1 167 }, 168 "uri": "file://INPUT_DIR/objc.h" 169 }, 170 "names": { 171 "navigator": [ 172 { 173 "kind": "identifier", 174 "spelling": "objc" 175 } 176 ], 177 "subHeading": [ 178 { 179 "kind": "identifier", 180 "spelling": "objc" 181 } 182 ], 183 "title": "objc" 184 }, 185 "pathComponents": [ 186 "objc" 187 ] 188 } 189 ] 190 } 191