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 -extract-api --product-name=TypedefChain -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 typedef int MyInt; 18 typedef MyInt MyIntInt; 19 typedef MyIntInt MyIntIntInt; 20 21 //--- reference.output.json.in 22 { 23 "metadata": { 24 "formatVersion": { 25 "major": 0, 26 "minor": 5, 27 "patch": 3 28 }, 29 "generator": "?" 30 }, 31 "module": { 32 "name": "TypedefChain", 33 "platform": { 34 "architecture": "arm64", 35 "operatingSystem": { 36 "minimumVersion": { 37 "major": 11, 38 "minor": 0, 39 "patch": 0 40 }, 41 "name": "macosx" 42 }, 43 "vendor": "apple" 44 } 45 }, 46 "relationships": [], 47 "symbols": [ 48 { 49 "accessLevel": "public", 50 "declarationFragments": [ 51 { 52 "kind": "keyword", 53 "spelling": "typedef" 54 }, 55 { 56 "kind": "text", 57 "spelling": " " 58 }, 59 { 60 "kind": "typeIdentifier", 61 "preciseIdentifier": "c:I", 62 "spelling": "int" 63 }, 64 { 65 "kind": "text", 66 "spelling": " " 67 }, 68 { 69 "kind": "identifier", 70 "spelling": "MyInt" 71 } 72 ], 73 "identifier": { 74 "interfaceLanguage": "objective-c", 75 "precise": "c:input.h@T@MyInt" 76 }, 77 "kind": { 78 "displayName": "Type Alias", 79 "identifier": "objective-c.typealias" 80 }, 81 "location": { 82 "position": { 83 "character": 13, 84 "line": 1 85 }, 86 "uri": "file://INPUT_DIR/input.h" 87 }, 88 "names": { 89 "navigator": [ 90 { 91 "kind": "identifier", 92 "spelling": "MyInt" 93 } 94 ], 95 "subHeading": [ 96 { 97 "kind": "identifier", 98 "spelling": "MyInt" 99 } 100 ], 101 "title": "MyInt" 102 }, 103 "pathComponents": [ 104 "MyInt" 105 ], 106 "type": "c:I" 107 }, 108 { 109 "accessLevel": "public", 110 "declarationFragments": [ 111 { 112 "kind": "keyword", 113 "spelling": "typedef" 114 }, 115 { 116 "kind": "text", 117 "spelling": " " 118 }, 119 { 120 "kind": "typeIdentifier", 121 "preciseIdentifier": "c:input.h@T@MyInt", 122 "spelling": "MyInt" 123 }, 124 { 125 "kind": "text", 126 "spelling": " " 127 }, 128 { 129 "kind": "identifier", 130 "spelling": "MyIntInt" 131 } 132 ], 133 "identifier": { 134 "interfaceLanguage": "objective-c", 135 "precise": "c:input.h@T@MyIntInt" 136 }, 137 "kind": { 138 "displayName": "Type Alias", 139 "identifier": "objective-c.typealias" 140 }, 141 "location": { 142 "position": { 143 "character": 15, 144 "line": 2 145 }, 146 "uri": "file://INPUT_DIR/input.h" 147 }, 148 "names": { 149 "navigator": [ 150 { 151 "kind": "identifier", 152 "spelling": "MyIntInt" 153 } 154 ], 155 "subHeading": [ 156 { 157 "kind": "identifier", 158 "spelling": "MyIntInt" 159 } 160 ], 161 "title": "MyIntInt" 162 }, 163 "pathComponents": [ 164 "MyIntInt" 165 ], 166 "type": "c:input.h@T@MyInt" 167 }, 168 { 169 "accessLevel": "public", 170 "declarationFragments": [ 171 { 172 "kind": "keyword", 173 "spelling": "typedef" 174 }, 175 { 176 "kind": "text", 177 "spelling": " " 178 }, 179 { 180 "kind": "typeIdentifier", 181 "preciseIdentifier": "c:input.h@T@MyIntInt", 182 "spelling": "MyIntInt" 183 }, 184 { 185 "kind": "text", 186 "spelling": " " 187 }, 188 { 189 "kind": "identifier", 190 "spelling": "MyIntIntInt" 191 } 192 ], 193 "identifier": { 194 "interfaceLanguage": "objective-c", 195 "precise": "c:input.h@T@MyIntIntInt" 196 }, 197 "kind": { 198 "displayName": "Type Alias", 199 "identifier": "objective-c.typealias" 200 }, 201 "location": { 202 "position": { 203 "character": 18, 204 "line": 3 205 }, 206 "uri": "file://INPUT_DIR/input.h" 207 }, 208 "names": { 209 "navigator": [ 210 { 211 "kind": "identifier", 212 "spelling": "MyIntIntInt" 213 } 214 ], 215 "subHeading": [ 216 { 217 "kind": "identifier", 218 "spelling": "MyIntIntInt" 219 } 220 ], 221 "title": "MyIntIntInt" 222 }, 223 "pathComponents": [ 224 "MyIntIntInt" 225 ], 226 "type": "c:input.h@T@MyIntInt" 227 } 228 ] 229 } 230