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_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \ 6 // RUN: -x c++-header %t/input.h -o %t/output.json -verify 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 //--- input.h 14 bool Foo; 15 16 bool IsFoo(bool Bar); 17 /// expected-no-diagnostics 18 19 //--- reference.output.json.in 20 { 21 "metadata": { 22 "formatVersion": { 23 "major": 0, 24 "minor": 5, 25 "patch": 3 26 }, 27 "generator": "?" 28 }, 29 "module": { 30 "name": "", 31 "platform": { 32 "architecture": "arm64", 33 "operatingSystem": { 34 "minimumVersion": { 35 "major": 11, 36 "minor": 0, 37 "patch": 0 38 }, 39 "name": "macosx" 40 }, 41 "vendor": "apple" 42 } 43 }, 44 "relationships": [], 45 "symbols": [ 46 { 47 "accessLevel": "public", 48 "declarationFragments": [ 49 { 50 "kind": "typeIdentifier", 51 "preciseIdentifier": "c:b", 52 "spelling": "bool" 53 }, 54 { 55 "kind": "text", 56 "spelling": " " 57 }, 58 { 59 "kind": "identifier", 60 "spelling": "Foo" 61 }, 62 { 63 "kind": "text", 64 "spelling": ";" 65 } 66 ], 67 "identifier": { 68 "interfaceLanguage": "c++", 69 "precise": "c:@Foo" 70 }, 71 "kind": { 72 "displayName": "Global Variable", 73 "identifier": "c++.var" 74 }, 75 "location": { 76 "position": { 77 "character": 5, 78 "line": 0 79 }, 80 "uri": "file://INPUT_DIR/input.h" 81 }, 82 "names": { 83 "navigator": [ 84 { 85 "kind": "identifier", 86 "spelling": "Foo" 87 } 88 ], 89 "subHeading": [ 90 { 91 "kind": "identifier", 92 "spelling": "Foo" 93 } 94 ], 95 "title": "Foo" 96 }, 97 "pathComponents": [ 98 "Foo" 99 ] 100 }, 101 { 102 "accessLevel": "public", 103 "declarationFragments": [ 104 { 105 "kind": "typeIdentifier", 106 "preciseIdentifier": "c:b", 107 "spelling": "bool" 108 }, 109 { 110 "kind": "text", 111 "spelling": " " 112 }, 113 { 114 "kind": "identifier", 115 "spelling": "IsFoo" 116 }, 117 { 118 "kind": "text", 119 "spelling": "(" 120 }, 121 { 122 "kind": "typeIdentifier", 123 "preciseIdentifier": "c:b", 124 "spelling": "bool" 125 }, 126 { 127 "kind": "text", 128 "spelling": " " 129 }, 130 { 131 "kind": "internalParam", 132 "spelling": "Bar" 133 }, 134 { 135 "kind": "text", 136 "spelling": ");" 137 } 138 ], 139 "functionSignature": { 140 "parameters": [ 141 { 142 "declarationFragments": [ 143 { 144 "kind": "typeIdentifier", 145 "preciseIdentifier": "c:b", 146 "spelling": "bool" 147 }, 148 { 149 "kind": "text", 150 "spelling": " " 151 }, 152 { 153 "kind": "internalParam", 154 "spelling": "Bar" 155 } 156 ], 157 "name": "Bar" 158 } 159 ], 160 "returns": [ 161 { 162 "kind": "typeIdentifier", 163 "preciseIdentifier": "c:b", 164 "spelling": "bool" 165 } 166 ] 167 }, 168 "identifier": { 169 "interfaceLanguage": "c++", 170 "precise": "c:@F@IsFoo#b#" 171 }, 172 "kind": { 173 "displayName": "Function", 174 "identifier": "c++.func" 175 }, 176 "location": { 177 "position": { 178 "character": 5, 179 "line": 2 180 }, 181 "uri": "file://INPUT_DIR/input.h" 182 }, 183 "names": { 184 "navigator": [ 185 { 186 "kind": "identifier", 187 "spelling": "IsFoo" 188 } 189 ], 190 "subHeading": [ 191 { 192 "kind": "identifier", 193 "spelling": "IsFoo" 194 } 195 ], 196 "title": "IsFoo" 197 }, 198 "pathComponents": [ 199 "IsFoo" 200 ] 201 } 202 ] 203 } 204