Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 14 | pmbaty | 1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
| 2 | |* *| |
||
| 3 | |* Helper classes for BasicWriters *| |
||
| 4 | |* *| |
||
| 5 | |* Automatically generated file, do not edit! *| |
||
| 6 | |* *| |
||
| 7 | \*===----------------------------------------------------------------------===*/ |
||
| 8 | |||
| 9 | template <class ValueType> |
||
| 10 | struct WriteDispatcher; |
||
| 11 | template <> |
||
| 12 | struct WriteDispatcher<llvm::APInt> { |
||
| 13 | template <class BasicWriter, class... Args> |
||
| 14 | static void write(BasicWriter &W, Args &&... args) { |
||
| 15 | return W.writeAPInt(std::forward<Args>(args)...); |
||
| 16 | } |
||
| 17 | }; |
||
| 18 | template <> |
||
| 19 | struct WriteDispatcher<llvm::APSInt> { |
||
| 20 | template <class BasicWriter, class... Args> |
||
| 21 | static void write(BasicWriter &W, Args &&... args) { |
||
| 22 | return W.writeAPSInt(std::forward<Args>(args)...); |
||
| 23 | } |
||
| 24 | }; |
||
| 25 | template <> |
||
| 26 | struct WriteDispatcher<APValue> { |
||
| 27 | template <class BasicWriter, class... Args> |
||
| 28 | static void write(BasicWriter &W, Args &&... args) { |
||
| 29 | return W.writeAPValue(std::forward<Args>(args)...); |
||
| 30 | } |
||
| 31 | }; |
||
| 32 | template <> |
||
| 33 | struct WriteDispatcher<APValue::ValueKind> { |
||
| 34 | template <class BasicWriter, class... Args> |
||
| 35 | static void write(BasicWriter &W, Args &&... args) { |
||
| 36 | return W.writeAPValueKind(std::forward<Args>(args)...); |
||
| 37 | } |
||
| 38 | }; |
||
| 39 | template <> |
||
| 40 | struct WriteDispatcher<ArrayType::ArraySizeModifier> { |
||
| 41 | template <class BasicWriter, class... Args> |
||
| 42 | static void write(BasicWriter &W, Args &&... args) { |
||
| 43 | return W.writeArraySizeModifier(std::forward<Args>(args)...); |
||
| 44 | } |
||
| 45 | }; |
||
| 46 | template <> |
||
| 47 | struct WriteDispatcher<attr::Kind> { |
||
| 48 | template <class BasicWriter, class... Args> |
||
| 49 | static void write(BasicWriter &W, Args &&... args) { |
||
| 50 | return W.writeAttrKind(std::forward<Args>(args)...); |
||
| 51 | } |
||
| 52 | }; |
||
| 53 | template <> |
||
| 54 | struct WriteDispatcher<AutoTypeKeyword> { |
||
| 55 | template <class BasicWriter, class... Args> |
||
| 56 | static void write(BasicWriter &W, Args &&... args) { |
||
| 57 | return W.writeAutoTypeKeyword(std::forward<Args>(args)...); |
||
| 58 | } |
||
| 59 | }; |
||
| 60 | template <> |
||
| 61 | struct WriteDispatcher<const BTFTypeTagAttr *> { |
||
| 62 | template <class BasicWriter, class... Args> |
||
| 63 | static void write(BasicWriter &W, Args &&... args) { |
||
| 64 | return W.writeBTFTypeTagAttr(std::forward<Args>(args)...); |
||
| 65 | } |
||
| 66 | }; |
||
| 67 | template <> |
||
| 68 | struct WriteDispatcher<bool> { |
||
| 69 | template <class BasicWriter, class... Args> |
||
| 70 | static void write(BasicWriter &W, Args &&... args) { |
||
| 71 | return W.writeBool(std::forward<Args>(args)...); |
||
| 72 | } |
||
| 73 | }; |
||
| 74 | template <> |
||
| 75 | struct WriteDispatcher<BuiltinType::Kind> { |
||
| 76 | template <class BasicWriter, class... Args> |
||
| 77 | static void write(BasicWriter &W, Args &&... args) { |
||
| 78 | return W.writeBuiltinTypeKind(std::forward<Args>(args)...); |
||
| 79 | } |
||
| 80 | }; |
||
| 81 | template <> |
||
| 82 | struct WriteDispatcher<CXXRecordDecl*> { |
||
| 83 | template <class BasicWriter, class... Args> |
||
| 84 | static void write(BasicWriter &W, Args &&... args) { |
||
| 85 | return W.writeCXXRecordDeclRef(std::forward<Args>(args)...); |
||
| 86 | } |
||
| 87 | }; |
||
| 88 | template <> |
||
| 89 | struct WriteDispatcher<const CXXRecordDecl*> { |
||
| 90 | template <class BasicWriter, class... Args> |
||
| 91 | static void write(BasicWriter &W, Args &&... args) { |
||
| 92 | return W.writeCXXRecordDeclRef(std::forward<Args>(args)...); |
||
| 93 | } |
||
| 94 | }; |
||
| 95 | template <> |
||
| 96 | struct WriteDispatcher<CallingConv> { |
||
| 97 | template <class BasicWriter, class... Args> |
||
| 98 | static void write(BasicWriter &W, Args &&... args) { |
||
| 99 | return W.writeCallingConv(std::forward<Args>(args)...); |
||
| 100 | } |
||
| 101 | }; |
||
| 102 | template <> |
||
| 103 | struct WriteDispatcher<ConceptDecl*> { |
||
| 104 | template <class BasicWriter, class... Args> |
||
| 105 | static void write(BasicWriter &W, Args &&... args) { |
||
| 106 | return W.writeConceptDeclRef(std::forward<Args>(args)...); |
||
| 107 | } |
||
| 108 | }; |
||
| 109 | template <> |
||
| 110 | struct WriteDispatcher<const ConceptDecl*> { |
||
| 111 | template <class BasicWriter, class... Args> |
||
| 112 | static void write(BasicWriter &W, Args &&... args) { |
||
| 113 | return W.writeConceptDeclRef(std::forward<Args>(args)...); |
||
| 114 | } |
||
| 115 | }; |
||
| 116 | template <> |
||
| 117 | struct WriteDispatcher<Decl*> { |
||
| 118 | template <class BasicWriter, class... Args> |
||
| 119 | static void write(BasicWriter &W, Args &&... args) { |
||
| 120 | return W.writeDeclRef(std::forward<Args>(args)...); |
||
| 121 | } |
||
| 122 | }; |
||
| 123 | template <> |
||
| 124 | struct WriteDispatcher<const Decl*> { |
||
| 125 | template <class BasicWriter, class... Args> |
||
| 126 | static void write(BasicWriter &W, Args &&... args) { |
||
| 127 | return W.writeDeclRef(std::forward<Args>(args)...); |
||
| 128 | } |
||
| 129 | }; |
||
| 130 | template <> |
||
| 131 | struct WriteDispatcher<DeclarationName> { |
||
| 132 | template <class BasicWriter, class... Args> |
||
| 133 | static void write(BasicWriter &W, Args &&... args) { |
||
| 134 | return W.writeDeclarationName(std::forward<Args>(args)...); |
||
| 135 | } |
||
| 136 | }; |
||
| 137 | template <> |
||
| 138 | struct WriteDispatcher<DeclarationName::NameKind> { |
||
| 139 | template <class BasicWriter, class... Args> |
||
| 140 | static void write(BasicWriter &W, Args &&... args) { |
||
| 141 | return W.writeDeclarationNameKind(std::forward<Args>(args)...); |
||
| 142 | } |
||
| 143 | }; |
||
| 144 | template <> |
||
| 145 | struct WriteDispatcher<ElaboratedTypeKeyword> { |
||
| 146 | template <class BasicWriter, class... Args> |
||
| 147 | static void write(BasicWriter &W, Args &&... args) { |
||
| 148 | return W.writeElaboratedTypeKeyword(std::forward<Args>(args)...); |
||
| 149 | } |
||
| 150 | }; |
||
| 151 | template <> |
||
| 152 | struct WriteDispatcher<FunctionProtoType::ExceptionSpecInfo> { |
||
| 153 | template <class BasicWriter, class... Args> |
||
| 154 | static void write(BasicWriter &W, Args &&... args) { |
||
| 155 | return W.writeExceptionSpecInfo(std::forward<Args>(args)...); |
||
| 156 | } |
||
| 157 | }; |
||
| 158 | template <> |
||
| 159 | struct WriteDispatcher<Expr*> { |
||
| 160 | template <class BasicWriter, class... Args> |
||
| 161 | static void write(BasicWriter &W, Args &&... args) { |
||
| 162 | return W.writeExprRef(std::forward<Args>(args)...); |
||
| 163 | } |
||
| 164 | }; |
||
| 165 | template <> |
||
| 166 | struct WriteDispatcher<const Expr*> { |
||
| 167 | template <class BasicWriter, class... Args> |
||
| 168 | static void write(BasicWriter &W, Args &&... args) { |
||
| 169 | return W.writeExprRef(std::forward<Args>(args)...); |
||
| 170 | } |
||
| 171 | }; |
||
| 172 | template <> |
||
| 173 | struct WriteDispatcher<FunctionProtoType::ExtParameterInfo> { |
||
| 174 | template <class BasicWriter, class... Args> |
||
| 175 | static void write(BasicWriter &W, Args &&... args) { |
||
| 176 | return W.writeExtParameterInfo(std::forward<Args>(args)...); |
||
| 177 | } |
||
| 178 | }; |
||
| 179 | template <> |
||
| 180 | struct WriteDispatcher<llvm::FixedPointSemantics> { |
||
| 181 | template <class BasicWriter, class... Args> |
||
| 182 | static void write(BasicWriter &W, Args &&... args) { |
||
| 183 | return W.writeFixedPointSemantics(std::forward<Args>(args)...); |
||
| 184 | } |
||
| 185 | }; |
||
| 186 | template <> |
||
| 187 | struct WriteDispatcher<FunctionDecl*> { |
||
| 188 | template <class BasicWriter, class... Args> |
||
| 189 | static void write(BasicWriter &W, Args &&... args) { |
||
| 190 | return W.writeFunctionDeclRef(std::forward<Args>(args)...); |
||
| 191 | } |
||
| 192 | }; |
||
| 193 | template <> |
||
| 194 | struct WriteDispatcher<const FunctionDecl*> { |
||
| 195 | template <class BasicWriter, class... Args> |
||
| 196 | static void write(BasicWriter &W, Args &&... args) { |
||
| 197 | return W.writeFunctionDeclRef(std::forward<Args>(args)...); |
||
| 198 | } |
||
| 199 | }; |
||
| 200 | template <> |
||
| 201 | struct WriteDispatcher<IdentifierInfo*> { |
||
| 202 | template <class BasicWriter, class... Args> |
||
| 203 | static void write(BasicWriter &W, Args &&... args) { |
||
| 204 | return W.writeIdentifier(std::forward<Args>(args)...); |
||
| 205 | } |
||
| 206 | }; |
||
| 207 | template <> |
||
| 208 | struct WriteDispatcher<const IdentifierInfo*> { |
||
| 209 | template <class BasicWriter, class... Args> |
||
| 210 | static void write(BasicWriter &W, Args &&... args) { |
||
| 211 | return W.writeIdentifier(std::forward<Args>(args)...); |
||
| 212 | } |
||
| 213 | }; |
||
| 214 | template <> |
||
| 215 | struct WriteDispatcher<APValue::LValuePathEntry> { |
||
| 216 | template <class BasicWriter, class... Args> |
||
| 217 | static void write(BasicWriter &W, Args &&... args) { |
||
| 218 | return W.writeLValuePathEntry(std::forward<Args>(args)...); |
||
| 219 | } |
||
| 220 | }; |
||
| 221 | template <> |
||
| 222 | struct WriteDispatcher<APValue::LValuePathSerializationHelper> { |
||
| 223 | template <class BasicWriter, class... Args> |
||
| 224 | static void write(BasicWriter &W, Args &&... args) { |
||
| 225 | return W.writeLValuePathSerializationHelper(std::forward<Args>(args)...); |
||
| 226 | } |
||
| 227 | }; |
||
| 228 | template <> |
||
| 229 | struct WriteDispatcher<NamedDecl*> { |
||
| 230 | template <class BasicWriter, class... Args> |
||
| 231 | static void write(BasicWriter &W, Args &&... args) { |
||
| 232 | return W.writeNamedDeclRef(std::forward<Args>(args)...); |
||
| 233 | } |
||
| 234 | }; |
||
| 235 | template <> |
||
| 236 | struct WriteDispatcher<const NamedDecl*> { |
||
| 237 | template <class BasicWriter, class... Args> |
||
| 238 | static void write(BasicWriter &W, Args &&... args) { |
||
| 239 | return W.writeNamedDeclRef(std::forward<Args>(args)...); |
||
| 240 | } |
||
| 241 | }; |
||
| 242 | template <> |
||
| 243 | struct WriteDispatcher<NamespaceAliasDecl*> { |
||
| 244 | template <class BasicWriter, class... Args> |
||
| 245 | static void write(BasicWriter &W, Args &&... args) { |
||
| 246 | return W.writeNamespaceAliasDeclRef(std::forward<Args>(args)...); |
||
| 247 | } |
||
| 248 | }; |
||
| 249 | template <> |
||
| 250 | struct WriteDispatcher<const NamespaceAliasDecl*> { |
||
| 251 | template <class BasicWriter, class... Args> |
||
| 252 | static void write(BasicWriter &W, Args &&... args) { |
||
| 253 | return W.writeNamespaceAliasDeclRef(std::forward<Args>(args)...); |
||
| 254 | } |
||
| 255 | }; |
||
| 256 | template <> |
||
| 257 | struct WriteDispatcher<NamespaceDecl*> { |
||
| 258 | template <class BasicWriter, class... Args> |
||
| 259 | static void write(BasicWriter &W, Args &&... args) { |
||
| 260 | return W.writeNamespaceDeclRef(std::forward<Args>(args)...); |
||
| 261 | } |
||
| 262 | }; |
||
| 263 | template <> |
||
| 264 | struct WriteDispatcher<const NamespaceDecl*> { |
||
| 265 | template <class BasicWriter, class... Args> |
||
| 266 | static void write(BasicWriter &W, Args &&... args) { |
||
| 267 | return W.writeNamespaceDeclRef(std::forward<Args>(args)...); |
||
| 268 | } |
||
| 269 | }; |
||
| 270 | template <> |
||
| 271 | struct WriteDispatcher<NestedNameSpecifier *> { |
||
| 272 | template <class BasicWriter, class... Args> |
||
| 273 | static void write(BasicWriter &W, Args &&... args) { |
||
| 274 | return W.writeNestedNameSpecifier(std::forward<Args>(args)...); |
||
| 275 | } |
||
| 276 | }; |
||
| 277 | template <> |
||
| 278 | struct WriteDispatcher<NestedNameSpecifier::SpecifierKind> { |
||
| 279 | template <class BasicWriter, class... Args> |
||
| 280 | static void write(BasicWriter &W, Args &&... args) { |
||
| 281 | return W.writeNestedNameSpecifierKind(std::forward<Args>(args)...); |
||
| 282 | } |
||
| 283 | }; |
||
| 284 | template <> |
||
| 285 | struct WriteDispatcher<ObjCProtocolDecl*> { |
||
| 286 | template <class BasicWriter, class... Args> |
||
| 287 | static void write(BasicWriter &W, Args &&... args) { |
||
| 288 | return W.writeObjCProtocolDeclRef(std::forward<Args>(args)...); |
||
| 289 | } |
||
| 290 | }; |
||
| 291 | template <> |
||
| 292 | struct WriteDispatcher<const ObjCProtocolDecl*> { |
||
| 293 | template <class BasicWriter, class... Args> |
||
| 294 | static void write(BasicWriter &W, Args &&... args) { |
||
| 295 | return W.writeObjCProtocolDeclRef(std::forward<Args>(args)...); |
||
| 296 | } |
||
| 297 | }; |
||
| 298 | template <> |
||
| 299 | struct WriteDispatcher<ObjCTypeParamDecl*> { |
||
| 300 | template <class BasicWriter, class... Args> |
||
| 301 | static void write(BasicWriter &W, Args &&... args) { |
||
| 302 | return W.writeObjCTypeParamDeclRef(std::forward<Args>(args)...); |
||
| 303 | } |
||
| 304 | }; |
||
| 305 | template <> |
||
| 306 | struct WriteDispatcher<const ObjCTypeParamDecl*> { |
||
| 307 | template <class BasicWriter, class... Args> |
||
| 308 | static void write(BasicWriter &W, Args &&... args) { |
||
| 309 | return W.writeObjCTypeParamDeclRef(std::forward<Args>(args)...); |
||
| 310 | } |
||
| 311 | }; |
||
| 312 | template <> |
||
| 313 | struct WriteDispatcher<OverloadedOperatorKind> { |
||
| 314 | template <class BasicWriter, class... Args> |
||
| 315 | static void write(BasicWriter &W, Args &&... args) { |
||
| 316 | return W.writeOverloadedOperatorKind(std::forward<Args>(args)...); |
||
| 317 | } |
||
| 318 | }; |
||
| 319 | template <> |
||
| 320 | struct WriteDispatcher<QualType> { |
||
| 321 | template <class BasicWriter, class... Args> |
||
| 322 | static void write(BasicWriter &W, Args &&... args) { |
||
| 323 | return W.writeQualType(std::forward<Args>(args)...); |
||
| 324 | } |
||
| 325 | }; |
||
| 326 | template <> |
||
| 327 | struct WriteDispatcher<Qualifiers> { |
||
| 328 | template <class BasicWriter, class... Args> |
||
| 329 | static void write(BasicWriter &W, Args &&... args) { |
||
| 330 | return W.writeQualifiers(std::forward<Args>(args)...); |
||
| 331 | } |
||
| 332 | }; |
||
| 333 | template <> |
||
| 334 | struct WriteDispatcher<RefQualifierKind> { |
||
| 335 | template <class BasicWriter, class... Args> |
||
| 336 | static void write(BasicWriter &W, Args &&... args) { |
||
| 337 | return W.writeRefQualifierKind(std::forward<Args>(args)...); |
||
| 338 | } |
||
| 339 | }; |
||
| 340 | template <> |
||
| 341 | struct WriteDispatcher<Selector> { |
||
| 342 | template <class BasicWriter, class... Args> |
||
| 343 | static void write(BasicWriter &W, Args &&... args) { |
||
| 344 | return W.writeSelector(std::forward<Args>(args)...); |
||
| 345 | } |
||
| 346 | }; |
||
| 347 | template <> |
||
| 348 | struct WriteDispatcher<SourceLocation> { |
||
| 349 | template <class BasicWriter, class... Args> |
||
| 350 | static void write(BasicWriter &W, Args &&... args) { |
||
| 351 | return W.writeSourceLocation(std::forward<Args>(args)...); |
||
| 352 | } |
||
| 353 | }; |
||
| 354 | template <> |
||
| 355 | struct WriteDispatcher<Stmt*> { |
||
| 356 | template <class BasicWriter, class... Args> |
||
| 357 | static void write(BasicWriter &W, Args &&... args) { |
||
| 358 | return W.writeStmtRef(std::forward<Args>(args)...); |
||
| 359 | } |
||
| 360 | }; |
||
| 361 | template <> |
||
| 362 | struct WriteDispatcher<const Stmt*> { |
||
| 363 | template <class BasicWriter, class... Args> |
||
| 364 | static void write(BasicWriter &W, Args &&... args) { |
||
| 365 | return W.writeStmtRef(std::forward<Args>(args)...); |
||
| 366 | } |
||
| 367 | }; |
||
| 368 | template <> |
||
| 369 | struct WriteDispatcher<TagDecl*> { |
||
| 370 | template <class BasicWriter, class... Args> |
||
| 371 | static void write(BasicWriter &W, Args &&... args) { |
||
| 372 | return W.writeTagDeclRef(std::forward<Args>(args)...); |
||
| 373 | } |
||
| 374 | }; |
||
| 375 | template <> |
||
| 376 | struct WriteDispatcher<const TagDecl*> { |
||
| 377 | template <class BasicWriter, class... Args> |
||
| 378 | static void write(BasicWriter &W, Args &&... args) { |
||
| 379 | return W.writeTagDeclRef(std::forward<Args>(args)...); |
||
| 380 | } |
||
| 381 | }; |
||
| 382 | template <> |
||
| 383 | struct WriteDispatcher<TemplateArgument> { |
||
| 384 | template <class BasicWriter, class... Args> |
||
| 385 | static void write(BasicWriter &W, Args &&... args) { |
||
| 386 | return W.writeTemplateArgument(std::forward<Args>(args)...); |
||
| 387 | } |
||
| 388 | }; |
||
| 389 | template <> |
||
| 390 | struct WriteDispatcher<TemplateArgument::ArgKind> { |
||
| 391 | template <class BasicWriter, class... Args> |
||
| 392 | static void write(BasicWriter &W, Args &&... args) { |
||
| 393 | return W.writeTemplateArgumentKind(std::forward<Args>(args)...); |
||
| 394 | } |
||
| 395 | }; |
||
| 396 | template <> |
||
| 397 | struct WriteDispatcher<TemplateDecl*> { |
||
| 398 | template <class BasicWriter, class... Args> |
||
| 399 | static void write(BasicWriter &W, Args &&... args) { |
||
| 400 | return W.writeTemplateDeclRef(std::forward<Args>(args)...); |
||
| 401 | } |
||
| 402 | }; |
||
| 403 | template <> |
||
| 404 | struct WriteDispatcher<const TemplateDecl*> { |
||
| 405 | template <class BasicWriter, class... Args> |
||
| 406 | static void write(BasicWriter &W, Args &&... args) { |
||
| 407 | return W.writeTemplateDeclRef(std::forward<Args>(args)...); |
||
| 408 | } |
||
| 409 | }; |
||
| 410 | template <> |
||
| 411 | struct WriteDispatcher<TemplateName> { |
||
| 412 | template <class BasicWriter, class... Args> |
||
| 413 | static void write(BasicWriter &W, Args &&... args) { |
||
| 414 | return W.writeTemplateName(std::forward<Args>(args)...); |
||
| 415 | } |
||
| 416 | }; |
||
| 417 | template <> |
||
| 418 | struct WriteDispatcher<TemplateName::NameKind> { |
||
| 419 | template <class BasicWriter, class... Args> |
||
| 420 | static void write(BasicWriter &W, Args &&... args) { |
||
| 421 | return W.writeTemplateNameKind(std::forward<Args>(args)...); |
||
| 422 | } |
||
| 423 | }; |
||
| 424 | template <> |
||
| 425 | struct WriteDispatcher<TemplateTemplateParmDecl*> { |
||
| 426 | template <class BasicWriter, class... Args> |
||
| 427 | static void write(BasicWriter &W, Args &&... args) { |
||
| 428 | return W.writeTemplateTemplateParmDeclRef(std::forward<Args>(args)...); |
||
| 429 | } |
||
| 430 | }; |
||
| 431 | template <> |
||
| 432 | struct WriteDispatcher<const TemplateTemplateParmDecl*> { |
||
| 433 | template <class BasicWriter, class... Args> |
||
| 434 | static void write(BasicWriter &W, Args &&... args) { |
||
| 435 | return W.writeTemplateTemplateParmDeclRef(std::forward<Args>(args)...); |
||
| 436 | } |
||
| 437 | }; |
||
| 438 | template <> |
||
| 439 | struct WriteDispatcher<TemplateTypeParmDecl*> { |
||
| 440 | template <class BasicWriter, class... Args> |
||
| 441 | static void write(BasicWriter &W, Args &&... args) { |
||
| 442 | return W.writeTemplateTypeParmDeclRef(std::forward<Args>(args)...); |
||
| 443 | } |
||
| 444 | }; |
||
| 445 | template <> |
||
| 446 | struct WriteDispatcher<const TemplateTypeParmDecl*> { |
||
| 447 | template <class BasicWriter, class... Args> |
||
| 448 | static void write(BasicWriter &W, Args &&... args) { |
||
| 449 | return W.writeTemplateTypeParmDeclRef(std::forward<Args>(args)...); |
||
| 450 | } |
||
| 451 | }; |
||
| 452 | template <> |
||
| 453 | struct WriteDispatcher<TypeOfKind> { |
||
| 454 | template <class BasicWriter, class... Args> |
||
| 455 | static void write(BasicWriter &W, Args &&... args) { |
||
| 456 | return W.writeTypeOfKind(std::forward<Args>(args)...); |
||
| 457 | } |
||
| 458 | }; |
||
| 459 | template <> |
||
| 460 | struct WriteDispatcher<uint32_t> { |
||
| 461 | template <class BasicWriter, class... Args> |
||
| 462 | static void write(BasicWriter &W, Args &&... args) { |
||
| 463 | return W.writeUInt32(std::forward<Args>(args)...); |
||
| 464 | } |
||
| 465 | }; |
||
| 466 | template <> |
||
| 467 | struct WriteDispatcher<uint64_t> { |
||
| 468 | template <class BasicWriter, class... Args> |
||
| 469 | static void write(BasicWriter &W, Args &&... args) { |
||
| 470 | return W.writeUInt64(std::forward<Args>(args)...); |
||
| 471 | } |
||
| 472 | }; |
||
| 473 | template <> |
||
| 474 | struct WriteDispatcher<UnaryTransformType::UTTKind> { |
||
| 475 | template <class BasicWriter, class... Args> |
||
| 476 | static void write(BasicWriter &W, Args &&... args) { |
||
| 477 | return W.writeUnaryTypeTransformKind(std::forward<Args>(args)...); |
||
| 478 | } |
||
| 479 | }; |
||
| 480 | template <> |
||
| 481 | struct WriteDispatcher<UsingShadowDecl*> { |
||
| 482 | template <class BasicWriter, class... Args> |
||
| 483 | static void write(BasicWriter &W, Args &&... args) { |
||
| 484 | return W.writeUsingShadowDeclRef(std::forward<Args>(args)...); |
||
| 485 | } |
||
| 486 | }; |
||
| 487 | template <> |
||
| 488 | struct WriteDispatcher<const UsingShadowDecl*> { |
||
| 489 | template <class BasicWriter, class... Args> |
||
| 490 | static void write(BasicWriter &W, Args &&... args) { |
||
| 491 | return W.writeUsingShadowDeclRef(std::forward<Args>(args)...); |
||
| 492 | } |
||
| 493 | }; |
||
| 494 | template <> |
||
| 495 | struct WriteDispatcher<ValueDecl*> { |
||
| 496 | template <class BasicWriter, class... Args> |
||
| 497 | static void write(BasicWriter &W, Args &&... args) { |
||
| 498 | return W.writeValueDeclRef(std::forward<Args>(args)...); |
||
| 499 | } |
||
| 500 | }; |
||
| 501 | template <> |
||
| 502 | struct WriteDispatcher<const ValueDecl*> { |
||
| 503 | template <class BasicWriter, class... Args> |
||
| 504 | static void write(BasicWriter &W, Args &&... args) { |
||
| 505 | return W.writeValueDeclRef(std::forward<Args>(args)...); |
||
| 506 | } |
||
| 507 | }; |
||
| 508 | template <> |
||
| 509 | struct WriteDispatcher<VectorType::VectorKind> { |
||
| 510 | template <class BasicWriter, class... Args> |
||
| 511 | static void write(BasicWriter &W, Args &&... args) { |
||
| 512 | return W.writeVectorKind(std::forward<Args>(args)...); |
||
| 513 | } |
||
| 514 | }; |
||
| 515 | template <class T> |
||
| 516 | struct WriteDispatcher<llvm::ArrayRef<T>> { |
||
| 517 | template <class BasicWriter, class... Args> |
||
| 518 | static void write(BasicWriter &W, Args &&... args) { |
||
| 519 | return W.writeArray(std::forward<Args>(args)...); |
||
| 520 | } |
||
| 521 | }; |
||
| 522 | template <class T> |
||
| 523 | struct WriteDispatcher<std::optional<T>> { |
||
| 524 | template <class BasicWriter, class... Args> |
||
| 525 | static void write(BasicWriter &W, Args &&... args) { |
||
| 526 | return W.writeOptional(std::forward<Args>(args)...); |
||
| 527 | } |
||
| 528 | }; |
||
| 529 | |||
| 530 | template <class ValueType> |
||
| 531 | struct PackOptionalValue; |
||
| 532 | template <> |
||
| 533 | struct PackOptionalValue<CXXRecordDecl*> { |
||
| 534 | static CXXRecordDecl* pack(std::optional<CXXRecordDecl*> value) { |
||
| 535 | return value ? *value : nullptr; |
||
| 536 | } |
||
| 537 | }; |
||
| 538 | template <> |
||
| 539 | struct PackOptionalValue<const CXXRecordDecl*> { |
||
| 540 | static const CXXRecordDecl* pack(std::optional<const CXXRecordDecl*> value) { |
||
| 541 | return value ? *value : nullptr; |
||
| 542 | } |
||
| 543 | }; |
||
| 544 | template <> |
||
| 545 | struct PackOptionalValue<ConceptDecl*> { |
||
| 546 | static ConceptDecl* pack(std::optional<ConceptDecl*> value) { |
||
| 547 | return value ? *value : nullptr; |
||
| 548 | } |
||
| 549 | }; |
||
| 550 | template <> |
||
| 551 | struct PackOptionalValue<const ConceptDecl*> { |
||
| 552 | static const ConceptDecl* pack(std::optional<const ConceptDecl*> value) { |
||
| 553 | return value ? *value : nullptr; |
||
| 554 | } |
||
| 555 | }; |
||
| 556 | template <> |
||
| 557 | struct PackOptionalValue<Decl*> { |
||
| 558 | static Decl* pack(std::optional<Decl*> value) { |
||
| 559 | return value ? *value : nullptr; |
||
| 560 | } |
||
| 561 | }; |
||
| 562 | template <> |
||
| 563 | struct PackOptionalValue<const Decl*> { |
||
| 564 | static const Decl* pack(std::optional<const Decl*> value) { |
||
| 565 | return value ? *value : nullptr; |
||
| 566 | } |
||
| 567 | }; |
||
| 568 | template <> |
||
| 569 | struct PackOptionalValue<Expr*> { |
||
| 570 | static Expr* pack(std::optional<Expr*> value) { |
||
| 571 | return value ? *value : nullptr; |
||
| 572 | } |
||
| 573 | }; |
||
| 574 | template <> |
||
| 575 | struct PackOptionalValue<const Expr*> { |
||
| 576 | static const Expr* pack(std::optional<const Expr*> value) { |
||
| 577 | return value ? *value : nullptr; |
||
| 578 | } |
||
| 579 | }; |
||
| 580 | template <> |
||
| 581 | struct PackOptionalValue<FunctionDecl*> { |
||
| 582 | static FunctionDecl* pack(std::optional<FunctionDecl*> value) { |
||
| 583 | return value ? *value : nullptr; |
||
| 584 | } |
||
| 585 | }; |
||
| 586 | template <> |
||
| 587 | struct PackOptionalValue<const FunctionDecl*> { |
||
| 588 | static const FunctionDecl* pack(std::optional<const FunctionDecl*> value) { |
||
| 589 | return value ? *value : nullptr; |
||
| 590 | } |
||
| 591 | }; |
||
| 592 | template <> |
||
| 593 | struct PackOptionalValue<IdentifierInfo*> { |
||
| 594 | static IdentifierInfo* pack(std::optional<IdentifierInfo*> value) { |
||
| 595 | return value ? *value : nullptr; |
||
| 596 | } |
||
| 597 | }; |
||
| 598 | template <> |
||
| 599 | struct PackOptionalValue<const IdentifierInfo*> { |
||
| 600 | static const IdentifierInfo* pack(std::optional<const IdentifierInfo*> value) { |
||
| 601 | return value ? *value : nullptr; |
||
| 602 | } |
||
| 603 | }; |
||
| 604 | template <> |
||
| 605 | struct PackOptionalValue<NamedDecl*> { |
||
| 606 | static NamedDecl* pack(std::optional<NamedDecl*> value) { |
||
| 607 | return value ? *value : nullptr; |
||
| 608 | } |
||
| 609 | }; |
||
| 610 | template <> |
||
| 611 | struct PackOptionalValue<const NamedDecl*> { |
||
| 612 | static const NamedDecl* pack(std::optional<const NamedDecl*> value) { |
||
| 613 | return value ? *value : nullptr; |
||
| 614 | } |
||
| 615 | }; |
||
| 616 | template <> |
||
| 617 | struct PackOptionalValue<NamespaceAliasDecl*> { |
||
| 618 | static NamespaceAliasDecl* pack(std::optional<NamespaceAliasDecl*> value) { |
||
| 619 | return value ? *value : nullptr; |
||
| 620 | } |
||
| 621 | }; |
||
| 622 | template <> |
||
| 623 | struct PackOptionalValue<const NamespaceAliasDecl*> { |
||
| 624 | static const NamespaceAliasDecl* pack(std::optional<const NamespaceAliasDecl*> value) { |
||
| 625 | return value ? *value : nullptr; |
||
| 626 | } |
||
| 627 | }; |
||
| 628 | template <> |
||
| 629 | struct PackOptionalValue<NamespaceDecl*> { |
||
| 630 | static NamespaceDecl* pack(std::optional<NamespaceDecl*> value) { |
||
| 631 | return value ? *value : nullptr; |
||
| 632 | } |
||
| 633 | }; |
||
| 634 | template <> |
||
| 635 | struct PackOptionalValue<const NamespaceDecl*> { |
||
| 636 | static const NamespaceDecl* pack(std::optional<const NamespaceDecl*> value) { |
||
| 637 | return value ? *value : nullptr; |
||
| 638 | } |
||
| 639 | }; |
||
| 640 | template <> |
||
| 641 | struct PackOptionalValue<ObjCProtocolDecl*> { |
||
| 642 | static ObjCProtocolDecl* pack(std::optional<ObjCProtocolDecl*> value) { |
||
| 643 | return value ? *value : nullptr; |
||
| 644 | } |
||
| 645 | }; |
||
| 646 | template <> |
||
| 647 | struct PackOptionalValue<const ObjCProtocolDecl*> { |
||
| 648 | static const ObjCProtocolDecl* pack(std::optional<const ObjCProtocolDecl*> value) { |
||
| 649 | return value ? *value : nullptr; |
||
| 650 | } |
||
| 651 | }; |
||
| 652 | template <> |
||
| 653 | struct PackOptionalValue<ObjCTypeParamDecl*> { |
||
| 654 | static ObjCTypeParamDecl* pack(std::optional<ObjCTypeParamDecl*> value) { |
||
| 655 | return value ? *value : nullptr; |
||
| 656 | } |
||
| 657 | }; |
||
| 658 | template <> |
||
| 659 | struct PackOptionalValue<const ObjCTypeParamDecl*> { |
||
| 660 | static const ObjCTypeParamDecl* pack(std::optional<const ObjCTypeParamDecl*> value) { |
||
| 661 | return value ? *value : nullptr; |
||
| 662 | } |
||
| 663 | }; |
||
| 664 | template <> |
||
| 665 | struct PackOptionalValue<QualType> { |
||
| 666 | static QualType pack(std::optional<QualType> value) { |
||
| 667 | return value ? *value : QualType(); |
||
| 668 | } |
||
| 669 | }; |
||
| 670 | template <> |
||
| 671 | struct PackOptionalValue<Stmt*> { |
||
| 672 | static Stmt* pack(std::optional<Stmt*> value) { |
||
| 673 | return value ? *value : nullptr; |
||
| 674 | } |
||
| 675 | }; |
||
| 676 | template <> |
||
| 677 | struct PackOptionalValue<const Stmt*> { |
||
| 678 | static const Stmt* pack(std::optional<const Stmt*> value) { |
||
| 679 | return value ? *value : nullptr; |
||
| 680 | } |
||
| 681 | }; |
||
| 682 | template <> |
||
| 683 | struct PackOptionalValue<TagDecl*> { |
||
| 684 | static TagDecl* pack(std::optional<TagDecl*> value) { |
||
| 685 | return value ? *value : nullptr; |
||
| 686 | } |
||
| 687 | }; |
||
| 688 | template <> |
||
| 689 | struct PackOptionalValue<const TagDecl*> { |
||
| 690 | static const TagDecl* pack(std::optional<const TagDecl*> value) { |
||
| 691 | return value ? *value : nullptr; |
||
| 692 | } |
||
| 693 | }; |
||
| 694 | template <> |
||
| 695 | struct PackOptionalValue<TemplateDecl*> { |
||
| 696 | static TemplateDecl* pack(std::optional<TemplateDecl*> value) { |
||
| 697 | return value ? *value : nullptr; |
||
| 698 | } |
||
| 699 | }; |
||
| 700 | template <> |
||
| 701 | struct PackOptionalValue<const TemplateDecl*> { |
||
| 702 | static const TemplateDecl* pack(std::optional<const TemplateDecl*> value) { |
||
| 703 | return value ? *value : nullptr; |
||
| 704 | } |
||
| 705 | }; |
||
| 706 | template <> |
||
| 707 | struct PackOptionalValue<TemplateName> { |
||
| 708 | static TemplateName pack(std::optional<TemplateName> value) { |
||
| 709 | return value ? *value : TemplateName(); |
||
| 710 | } |
||
| 711 | }; |
||
| 712 | template <> |
||
| 713 | struct PackOptionalValue<TemplateTemplateParmDecl*> { |
||
| 714 | static TemplateTemplateParmDecl* pack(std::optional<TemplateTemplateParmDecl*> value) { |
||
| 715 | return value ? *value : nullptr; |
||
| 716 | } |
||
| 717 | }; |
||
| 718 | template <> |
||
| 719 | struct PackOptionalValue<const TemplateTemplateParmDecl*> { |
||
| 720 | static const TemplateTemplateParmDecl* pack(std::optional<const TemplateTemplateParmDecl*> value) { |
||
| 721 | return value ? *value : nullptr; |
||
| 722 | } |
||
| 723 | }; |
||
| 724 | template <> |
||
| 725 | struct PackOptionalValue<TemplateTypeParmDecl*> { |
||
| 726 | static TemplateTypeParmDecl* pack(std::optional<TemplateTypeParmDecl*> value) { |
||
| 727 | return value ? *value : nullptr; |
||
| 728 | } |
||
| 729 | }; |
||
| 730 | template <> |
||
| 731 | struct PackOptionalValue<const TemplateTypeParmDecl*> { |
||
| 732 | static const TemplateTypeParmDecl* pack(std::optional<const TemplateTypeParmDecl*> value) { |
||
| 733 | return value ? *value : nullptr; |
||
| 734 | } |
||
| 735 | }; |
||
| 736 | template <> |
||
| 737 | struct PackOptionalValue<uint32_t> { |
||
| 738 | static uint32_t pack(std::optional<uint32_t> value) { |
||
| 739 | return value ? *value + 1 : 0; |
||
| 740 | } |
||
| 741 | }; |
||
| 742 | template <> |
||
| 743 | struct PackOptionalValue<uint64_t> { |
||
| 744 | static uint64_t pack(std::optional<uint64_t> value) { |
||
| 745 | return value ? *value + 1 : 0; |
||
| 746 | } |
||
| 747 | }; |
||
| 748 | template <> |
||
| 749 | struct PackOptionalValue<UsingShadowDecl*> { |
||
| 750 | static UsingShadowDecl* pack(std::optional<UsingShadowDecl*> value) { |
||
| 751 | return value ? *value : nullptr; |
||
| 752 | } |
||
| 753 | }; |
||
| 754 | template <> |
||
| 755 | struct PackOptionalValue<const UsingShadowDecl*> { |
||
| 756 | static const UsingShadowDecl* pack(std::optional<const UsingShadowDecl*> value) { |
||
| 757 | return value ? *value : nullptr; |
||
| 758 | } |
||
| 759 | }; |
||
| 760 | template <> |
||
| 761 | struct PackOptionalValue<ValueDecl*> { |
||
| 762 | static ValueDecl* pack(std::optional<ValueDecl*> value) { |
||
| 763 | return value ? *value : nullptr; |
||
| 764 | } |
||
| 765 | }; |
||
| 766 | template <> |
||
| 767 | struct PackOptionalValue<const ValueDecl*> { |
||
| 768 | static const ValueDecl* pack(std::optional<const ValueDecl*> value) { |
||
| 769 | return value ? *value : nullptr; |
||
| 770 | } |
||
| 771 | }; |
||
| 772 | |||
| 773 | template <class Impl> |
||
| 774 | class BasicWriterBase { |
||
| 775 | ASTContext &C; |
||
| 776 | protected: |
||
| 777 | BasicWriterBase(ASTContext &ctx) : C(ctx) {} |
||
| 778 | public: |
||
| 779 | ASTContext &getASTContext() { return C; } |
||
| 780 | Impl &asImpl() { return static_cast<Impl&>(*this); } |
||
| 781 | void writeAPValue(const APValue & node) { |
||
| 782 | auto &&subW = asImpl().writeObject(); |
||
| 783 | APValue::ValueKind kind = (node.getKind()); |
||
| 784 | subW.find("kind").writeAPValueKind(kind); |
||
| 785 | switch (kind) { |
||
| 786 | case APValue::None: { |
||
| 787 | return; |
||
| 788 | } |
||
| 789 | |||
| 790 | case APValue::FixedPoint: { |
||
| 791 | llvm::FixedPointSemantics semantics = ( node.getFixedPoint().getSemantics() ); |
||
| 792 | subW.find("semantics").writeFixedPointSemantics(semantics); |
||
| 793 | llvm::APSInt value = ( node.getFixedPoint().getValue() ); |
||
| 794 | subW.find("value").writeAPSInt(value); |
||
| 795 | return; |
||
| 796 | } |
||
| 797 | |||
| 798 | case APValue::ComplexInt: { |
||
| 799 | llvm::APSInt real = ( node.getComplexIntReal() ); |
||
| 800 | subW.find("real").writeAPSInt(real); |
||
| 801 | llvm::APSInt imag = ( node.getComplexIntImag() ); |
||
| 802 | subW.find("imag").writeAPSInt(imag); |
||
| 803 | return; |
||
| 804 | } |
||
| 805 | |||
| 806 | case APValue::ComplexFloat: { |
||
| 807 | |||
| 808 | auto sema = llvm::APFloatBase::SemanticsToEnum( |
||
| 809 | node.getComplexFloatReal().getSemantics()); |
||
| 810 | assert(sema == llvm::APFloatBase::SemanticsToEnum( |
||
| 811 | node.getComplexFloatImag().getSemantics())); |
||
| 812 | |||
| 813 | uint32_t semantics = ( static_cast<uint32_t>(sema) ); |
||
| 814 | subW.find("semantics").writeUInt32(semantics); |
||
| 815 | llvm::APInt real = ( node.getComplexFloatReal().bitcastToAPInt() ); |
||
| 816 | subW.find("real").writeAPInt(real); |
||
| 817 | llvm::APInt imag = ( node.getComplexFloatImag().bitcastToAPInt() ); |
||
| 818 | subW.find("imag").writeAPInt(imag); |
||
| 819 | return; |
||
| 820 | } |
||
| 821 | |||
| 822 | case APValue::Vector: { |
||
| 823 | |||
| 824 | SmallVector<APValue, 4> buffer; |
||
| 825 | unsigned len = node.getVectorLength(); |
||
| 826 | for (unsigned i = 0; i < len; ++i) |
||
| 827 | buffer.push_back(node.getVectorElt(i)); |
||
| 828 | |||
| 829 | llvm::ArrayRef<APValue> elements = ( buffer ); |
||
| 830 | subW.find("elements").writeArray(elements); |
||
| 831 | return; |
||
| 832 | } |
||
| 833 | |||
| 834 | case APValue::Indeterminate: { |
||
| 835 | return; |
||
| 836 | } |
||
| 837 | |||
| 838 | case APValue::Array: { |
||
| 839 | |||
| 840 | SmallVector<APValue, 4> buffer{}; |
||
| 841 | unsigned initLength = node.getArrayInitializedElts(); |
||
| 842 | for (unsigned i = 0; i < initLength; ++i) |
||
| 843 | buffer.push_back(node.getArrayInitializedElt(i)); |
||
| 844 | if (node.hasArrayFiller()) |
||
| 845 | buffer.push_back(node.getArrayFiller()); |
||
| 846 | |||
| 847 | uint32_t totalLength = ( node.getArraySize() ); |
||
| 848 | subW.find("totalLength").writeUInt32(totalLength); |
||
| 849 | bool hasFiller = ( node.hasArrayFiller() ); |
||
| 850 | subW.find("hasFiller").writeBool(hasFiller); |
||
| 851 | llvm::ArrayRef<APValue> elements = ( buffer ); |
||
| 852 | subW.find("elements").writeArray(elements); |
||
| 853 | return; |
||
| 854 | } |
||
| 855 | |||
| 856 | case APValue::Struct: { |
||
| 857 | |||
| 858 | SmallVector<APValue, 4> structBases; |
||
| 859 | unsigned numBases = node.getStructNumBases(); |
||
| 860 | for (unsigned i = 0; i < numBases; ++i) |
||
| 861 | structBases.push_back(node.getStructBase(i)); |
||
| 862 | SmallVector<APValue, 4> structFields; |
||
| 863 | unsigned numFields = node.getStructNumFields(); |
||
| 864 | for (unsigned i = 0; i < numFields; ++i) |
||
| 865 | structFields.push_back(node.getStructField(i)); |
||
| 866 | |||
| 867 | llvm::ArrayRef<APValue> bases = ( structBases ); |
||
| 868 | subW.find("bases").writeArray(bases); |
||
| 869 | llvm::ArrayRef<APValue> fields = ( structFields ); |
||
| 870 | subW.find("fields").writeArray(fields); |
||
| 871 | return; |
||
| 872 | } |
||
| 873 | |||
| 874 | case APValue::Union: { |
||
| 875 | const Decl* fieldDecl = ( node.getUnionField() ); |
||
| 876 | subW.find("fieldDecl").writeDeclRef(fieldDecl); |
||
| 877 | APValue value = ( node.getUnionValue() ); |
||
| 878 | subW.find("value").writeAPValue(value); |
||
| 879 | return; |
||
| 880 | } |
||
| 881 | |||
| 882 | case APValue::AddrLabelDiff: { |
||
| 883 | const Stmt* lhs = ( const_cast<AddrLabelExpr *>(node.getAddrLabelDiffLHS()) ); |
||
| 884 | subW.find("lhs").writeStmtRef(lhs); |
||
| 885 | const Stmt* rhs = ( const_cast<AddrLabelExpr *>(node.getAddrLabelDiffRHS()) ); |
||
| 886 | subW.find("rhs").writeStmtRef(rhs); |
||
| 887 | return; |
||
| 888 | } |
||
| 889 | |||
| 890 | case APValue::Int: { |
||
| 891 | llvm::APSInt value = ( node.getInt() ); |
||
| 892 | subW.find("value").writeAPSInt(value); |
||
| 893 | return; |
||
| 894 | } |
||
| 895 | |||
| 896 | case APValue::MemberPointer: { |
||
| 897 | bool isDerived = ( node.isMemberPointerToDerivedMember() ); |
||
| 898 | subW.find("isDerived").writeBool(isDerived); |
||
| 899 | const ValueDecl* member = ( node.getMemberPointerDecl() ); |
||
| 900 | subW.find("member").writeValueDeclRef(member); |
||
| 901 | llvm::ArrayRef<const CXXRecordDecl*> memberPath = ( node.getMemberPointerPath() ); |
||
| 902 | subW.find("memberPath").writeArray(memberPath); |
||
| 903 | return; |
||
| 904 | } |
||
| 905 | |||
| 906 | case APValue::LValue: { |
||
| 907 | |||
| 908 | auto lvalueBase = node.getLValueBase(); |
||
| 909 | const Expr *expr = |
||
| 910 | lvalueBase ? lvalueBase.dyn_cast<const Expr *>() : nullptr; |
||
| 911 | bool lvalueBaseIsExpr = (bool) expr; |
||
| 912 | bool lvalueBaseIsTypeInfo = lvalueBase.is<TypeInfoLValue>(); |
||
| 913 | QualType elemTy; |
||
| 914 | if (lvalueBase) { |
||
| 915 | if (lvalueBaseIsTypeInfo) { |
||
| 916 | elemTy = lvalueBase.getTypeInfoType(); |
||
| 917 | } else if (lvalueBaseIsExpr) { |
||
| 918 | elemTy = expr->getType(); |
||
| 919 | } else { |
||
| 920 | elemTy = lvalueBase.get<const ValueDecl *>()->getType(); |
||
| 921 | } |
||
| 922 | } |
||
| 923 | |||
| 924 | bool hasLValuePath = ( node.hasLValuePath() ); |
||
| 925 | subW.find("hasLValuePath").writeBool(hasLValuePath); |
||
| 926 | bool isLValueOnePastTheEnd = ( node.isLValueOnePastTheEnd() ); |
||
| 927 | subW.find("isLValueOnePastTheEnd").writeBool(isLValueOnePastTheEnd); |
||
| 928 | bool isExpr = ( lvalueBaseIsExpr ); |
||
| 929 | subW.find("isExpr").writeBool(isExpr); |
||
| 930 | bool isTypeInfo = ( lvalueBaseIsTypeInfo ); |
||
| 931 | subW.find("isTypeInfo").writeBool(isTypeInfo); |
||
| 932 | bool hasBase = ( static_cast<bool>(lvalueBase) ); |
||
| 933 | subW.find("hasBase").writeBool(hasBase); |
||
| 934 | bool isNullPtr = ( node.isNullPointer() ); |
||
| 935 | subW.find("isNullPtr").writeBool(isNullPtr); |
||
| 936 | if ( hasBase && isTypeInfo ) { |
||
| 937 | QualType typeInfo = ( |
||
| 938 | QualType(node.getLValueBase().get<TypeInfoLValue>().getType(), 0) |
||
| 939 | ); |
||
| 940 | subW.find("typeInfo").writeQualType(typeInfo); |
||
| 941 | } |
||
| 942 | if ( hasBase && isTypeInfo ) { |
||
| 943 | QualType type = ( node.getLValueBase().getTypeInfoType() ); |
||
| 944 | subW.find("type").writeQualType(type); |
||
| 945 | } |
||
| 946 | if ( hasBase && !isTypeInfo ) { |
||
| 947 | uint32_t callIndex = ( node.getLValueBase().getCallIndex() ); |
||
| 948 | subW.find("callIndex").writeUInt32(callIndex); |
||
| 949 | } |
||
| 950 | if ( hasBase && !isTypeInfo ) { |
||
| 951 | uint32_t version = ( node.getLValueBase().getVersion() ); |
||
| 952 | subW.find("version").writeUInt32(version); |
||
| 953 | } |
||
| 954 | if ( hasBase && !isTypeInfo && isExpr ) { |
||
| 955 | const Stmt* stmt = ( const_cast<Expr *>(expr) ); |
||
| 956 | subW.find("stmt").writeStmtRef(stmt); |
||
| 957 | } |
||
| 958 | if ( hasBase && !isTypeInfo && !isExpr ) { |
||
| 959 | const Decl* decl = ( lvalueBase.get<const ValueDecl *>() ); |
||
| 960 | subW.find("decl").writeDeclRef(decl); |
||
| 961 | } |
||
| 962 | uint32_t offsetQuantity = ( node.getLValueOffset().getQuantity() ); |
||
| 963 | subW.find("offsetQuantity").writeUInt32(offsetQuantity); |
||
| 964 | if ( hasLValuePath ) { |
||
| 965 | APValue::LValuePathSerializationHelper lvaluePath = ( |
||
| 966 | APValue::LValuePathSerializationHelper(node.getLValuePath(), elemTy) |
||
| 967 | ); |
||
| 968 | subW.find("lvaluePath").writeLValuePathSerializationHelper(lvaluePath); |
||
| 969 | } |
||
| 970 | return; |
||
| 971 | } |
||
| 972 | |||
| 973 | case APValue::Float: { |
||
| 974 | llvm::APInt value = ( node.getFloat().bitcastToAPInt() ); |
||
| 975 | subW.find("value").writeAPInt(value); |
||
| 976 | uint32_t semantics = ( |
||
| 977 | static_cast<uint32_t>( |
||
| 978 | llvm::APFloatBase::SemanticsToEnum(node.getFloat().getSemantics())) |
||
| 979 | ); |
||
| 980 | subW.find("semantics").writeUInt32(semantics); |
||
| 981 | return; |
||
| 982 | } |
||
| 983 | |||
| 984 | } |
||
| 985 | llvm_unreachable("bad APValue::ValueKind"); |
||
| 986 | } |
||
| 987 | void writeAPValueKind(APValue::ValueKind value) { |
||
| 988 | asImpl().writeEnum(value); |
||
| 989 | } |
||
| 990 | void writeArraySizeModifier(ArrayType::ArraySizeModifier value) { |
||
| 991 | asImpl().writeEnum(value); |
||
| 992 | } |
||
| 993 | void writeAttrKind(attr::Kind value) { |
||
| 994 | asImpl().writeEnum(value); |
||
| 995 | } |
||
| 996 | void writeAutoTypeKeyword(AutoTypeKeyword value) { |
||
| 997 | asImpl().writeEnum(value); |
||
| 998 | } |
||
| 999 | void writeBuiltinTypeKind(BuiltinType::Kind value) { |
||
| 1000 | asImpl().writeEnum(value); |
||
| 1001 | } |
||
| 1002 | void writeCXXRecordDeclRef(const CXXRecordDecl* value) { |
||
| 1003 | asImpl().writeDeclRef(value); |
||
| 1004 | } |
||
| 1005 | void writeCallingConv(CallingConv value) { |
||
| 1006 | asImpl().writeEnum(value); |
||
| 1007 | } |
||
| 1008 | void writeConceptDeclRef(const ConceptDecl* value) { |
||
| 1009 | asImpl().writeDeclRef(value); |
||
| 1010 | } |
||
| 1011 | void writeDeclarationName(DeclarationName node) { |
||
| 1012 | auto &&subW = asImpl().writeObject(); |
||
| 1013 | DeclarationName::NameKind kind = (node.getNameKind()); |
||
| 1014 | subW.find("kind").writeDeclarationNameKind(kind); |
||
| 1015 | switch (kind) { |
||
| 1016 | case DeclarationName::CXXLiteralOperatorName: { |
||
| 1017 | const IdentifierInfo* identifier = ( node.getCXXLiteralIdentifier() ); |
||
| 1018 | subW.find("identifier").writeIdentifier(identifier); |
||
| 1019 | return; |
||
| 1020 | } |
||
| 1021 | |||
| 1022 | case DeclarationName::CXXUsingDirective: { |
||
| 1023 | return; |
||
| 1024 | } |
||
| 1025 | |||
| 1026 | case DeclarationName::Identifier: { |
||
| 1027 | const IdentifierInfo* identifier = ( node.getAsIdentifierInfo() ); |
||
| 1028 | subW.find("identifier").writeIdentifier(identifier); |
||
| 1029 | return; |
||
| 1030 | } |
||
| 1031 | |||
| 1032 | case DeclarationName::ObjCZeroArgSelector: { |
||
| 1033 | Selector selector = ( node.getObjCSelector() ); |
||
| 1034 | subW.find("selector").writeSelector(selector); |
||
| 1035 | return; |
||
| 1036 | } |
||
| 1037 | |||
| 1038 | case DeclarationName::ObjCOneArgSelector: { |
||
| 1039 | Selector selector = ( node.getObjCSelector() ); |
||
| 1040 | subW.find("selector").writeSelector(selector); |
||
| 1041 | return; |
||
| 1042 | } |
||
| 1043 | |||
| 1044 | case DeclarationName::ObjCMultiArgSelector: { |
||
| 1045 | Selector selector = ( node.getObjCSelector() ); |
||
| 1046 | subW.find("selector").writeSelector(selector); |
||
| 1047 | return; |
||
| 1048 | } |
||
| 1049 | |||
| 1050 | case DeclarationName::CXXConstructorName: { |
||
| 1051 | QualType type = ( node.getCXXNameType() ); |
||
| 1052 | subW.find("type").writeQualType(type); |
||
| 1053 | return; |
||
| 1054 | } |
||
| 1055 | |||
| 1056 | case DeclarationName::CXXDestructorName: { |
||
| 1057 | QualType type = ( node.getCXXNameType() ); |
||
| 1058 | subW.find("type").writeQualType(type); |
||
| 1059 | return; |
||
| 1060 | } |
||
| 1061 | |||
| 1062 | case DeclarationName::CXXConversionFunctionName: { |
||
| 1063 | QualType type = ( node.getCXXNameType() ); |
||
| 1064 | subW.find("type").writeQualType(type); |
||
| 1065 | return; |
||
| 1066 | } |
||
| 1067 | |||
| 1068 | case DeclarationName::CXXDeductionGuideName: { |
||
| 1069 | const TemplateDecl* declaration = ( node.getCXXDeductionGuideTemplate() ); |
||
| 1070 | subW.find("declaration").writeTemplateDeclRef(declaration); |
||
| 1071 | return; |
||
| 1072 | } |
||
| 1073 | |||
| 1074 | case DeclarationName::CXXOperatorName: { |
||
| 1075 | OverloadedOperatorKind operatorKind = ( node.getCXXOverloadedOperator() ); |
||
| 1076 | subW.find("operatorKind").writeOverloadedOperatorKind(operatorKind); |
||
| 1077 | return; |
||
| 1078 | } |
||
| 1079 | |||
| 1080 | } |
||
| 1081 | llvm_unreachable("bad DeclarationName::NameKind"); |
||
| 1082 | } |
||
| 1083 | void writeDeclarationNameKind(DeclarationName::NameKind value) { |
||
| 1084 | asImpl().writeEnum(value); |
||
| 1085 | } |
||
| 1086 | void writeElaboratedTypeKeyword(ElaboratedTypeKeyword value) { |
||
| 1087 | asImpl().writeEnum(value); |
||
| 1088 | } |
||
| 1089 | void writeExprRef(const Expr* value) { |
||
| 1090 | asImpl().writeStmtRef(value); |
||
| 1091 | } |
||
| 1092 | void writeFunctionDeclRef(const FunctionDecl* value) { |
||
| 1093 | asImpl().writeDeclRef(value); |
||
| 1094 | } |
||
| 1095 | void writeNamedDeclRef(const NamedDecl* value) { |
||
| 1096 | asImpl().writeDeclRef(value); |
||
| 1097 | } |
||
| 1098 | void writeNamespaceAliasDeclRef(const NamespaceAliasDecl* value) { |
||
| 1099 | asImpl().writeDeclRef(value); |
||
| 1100 | } |
||
| 1101 | void writeNamespaceDeclRef(const NamespaceDecl* value) { |
||
| 1102 | asImpl().writeDeclRef(value); |
||
| 1103 | } |
||
| 1104 | void writeNestedNameSpecifierKind(NestedNameSpecifier::SpecifierKind value) { |
||
| 1105 | asImpl().writeEnum(value); |
||
| 1106 | } |
||
| 1107 | void writeObjCProtocolDeclRef(const ObjCProtocolDecl* value) { |
||
| 1108 | asImpl().writeDeclRef(value); |
||
| 1109 | } |
||
| 1110 | void writeObjCTypeParamDeclRef(const ObjCTypeParamDecl* value) { |
||
| 1111 | asImpl().writeDeclRef(value); |
||
| 1112 | } |
||
| 1113 | void writeOverloadedOperatorKind(OverloadedOperatorKind value) { |
||
| 1114 | asImpl().writeEnum(value); |
||
| 1115 | } |
||
| 1116 | void writeRefQualifierKind(RefQualifierKind value) { |
||
| 1117 | asImpl().writeEnum(value); |
||
| 1118 | } |
||
| 1119 | void writeTagDeclRef(const TagDecl* value) { |
||
| 1120 | asImpl().writeDeclRef(value); |
||
| 1121 | } |
||
| 1122 | void writeTemplateArgument(TemplateArgument node) { |
||
| 1123 | auto &&subW = asImpl().writeObject(); |
||
| 1124 | TemplateArgument::ArgKind kind = (node.getKind()); |
||
| 1125 | subW.find("kind").writeTemplateArgumentKind(kind); |
||
| 1126 | switch (kind) { |
||
| 1127 | case TemplateArgument::Null: { |
||
| 1128 | return; |
||
| 1129 | } |
||
| 1130 | |||
| 1131 | case TemplateArgument::Type: { |
||
| 1132 | QualType type = ( node.getAsType() ); |
||
| 1133 | subW.find("type").writeQualType(type); |
||
| 1134 | return; |
||
| 1135 | } |
||
| 1136 | |||
| 1137 | case TemplateArgument::Declaration: { |
||
| 1138 | const ValueDecl* declaration = ( node.getAsDecl() ); |
||
| 1139 | subW.find("declaration").writeValueDeclRef(declaration); |
||
| 1140 | QualType parameterType = ( node.getParamTypeForDecl() ); |
||
| 1141 | subW.find("parameterType").writeQualType(parameterType); |
||
| 1142 | return; |
||
| 1143 | } |
||
| 1144 | |||
| 1145 | case TemplateArgument::NullPtr: { |
||
| 1146 | QualType type = ( node.getNullPtrType() ); |
||
| 1147 | subW.find("type").writeQualType(type); |
||
| 1148 | return; |
||
| 1149 | } |
||
| 1150 | |||
| 1151 | case TemplateArgument::Integral: { |
||
| 1152 | llvm::APSInt value = ( node.getAsIntegral() ); |
||
| 1153 | subW.find("value").writeAPSInt(value); |
||
| 1154 | QualType type = ( node.getIntegralType() ); |
||
| 1155 | subW.find("type").writeQualType(type); |
||
| 1156 | return; |
||
| 1157 | } |
||
| 1158 | |||
| 1159 | case TemplateArgument::Template: { |
||
| 1160 | TemplateName name = ( node.getAsTemplateOrTemplatePattern() ); |
||
| 1161 | subW.find("name").writeTemplateName(name); |
||
| 1162 | return; |
||
| 1163 | } |
||
| 1164 | |||
| 1165 | case TemplateArgument::TemplateExpansion: { |
||
| 1166 | TemplateName name = ( node.getAsTemplateOrTemplatePattern() ); |
||
| 1167 | subW.find("name").writeTemplateName(name); |
||
| 1168 | std::optional<uint32_t> numExpansions = ( |
||
| 1169 | // Translate unsigned -> uint32_t just in case. |
||
| 1170 | llvm::transformOptional(node.getNumTemplateExpansions(), |
||
| 1171 | [](unsigned i) { return uint32_t(i); }) |
||
| 1172 | ); |
||
| 1173 | subW.find("numExpansions").writeOptional(numExpansions); |
||
| 1174 | return; |
||
| 1175 | } |
||
| 1176 | |||
| 1177 | case TemplateArgument::Expression: { |
||
| 1178 | const Expr* expression = ( node.getAsExpr() ); |
||
| 1179 | subW.find("expression").writeExprRef(expression); |
||
| 1180 | return; |
||
| 1181 | } |
||
| 1182 | |||
| 1183 | case TemplateArgument::Pack: { |
||
| 1184 | llvm::ArrayRef<TemplateArgument> elements = ( node.pack_elements() ); |
||
| 1185 | subW.find("elements").writeArray(elements); |
||
| 1186 | return; |
||
| 1187 | } |
||
| 1188 | |||
| 1189 | } |
||
| 1190 | llvm_unreachable("bad TemplateArgument::ArgKind"); |
||
| 1191 | } |
||
| 1192 | void writeTemplateArgumentKind(TemplateArgument::ArgKind value) { |
||
| 1193 | asImpl().writeEnum(value); |
||
| 1194 | } |
||
| 1195 | void writeTemplateDeclRef(const TemplateDecl* value) { |
||
| 1196 | asImpl().writeDeclRef(value); |
||
| 1197 | } |
||
| 1198 | void writeTemplateName(TemplateName node) { |
||
| 1199 | auto &&subW = asImpl().writeObject(); |
||
| 1200 | TemplateName::NameKind kind = (node.getKind()); |
||
| 1201 | subW.find("kind").writeTemplateNameKind(kind); |
||
| 1202 | switch (kind) { |
||
| 1203 | case TemplateName::Template: { |
||
| 1204 | const TemplateDecl* declaration = ( node.getAsTemplateDecl() ); |
||
| 1205 | subW.find("declaration").writeTemplateDeclRef(declaration); |
||
| 1206 | return; |
||
| 1207 | } |
||
| 1208 | |||
| 1209 | case TemplateName::UsingTemplate: { |
||
| 1210 | const UsingShadowDecl* foundDecl = ( node.getAsUsingShadowDecl() ); |
||
| 1211 | subW.find("foundDecl").writeUsingShadowDeclRef(foundDecl); |
||
| 1212 | return; |
||
| 1213 | } |
||
| 1214 | |||
| 1215 | case TemplateName::OverloadedTemplate: { |
||
| 1216 | llvm::ArrayRef<const NamedDecl*> overloads = ( node.getAsOverloadedTemplate()->decls() ); |
||
| 1217 | subW.find("overloads").writeArray(overloads); |
||
| 1218 | return; |
||
| 1219 | } |
||
| 1220 | |||
| 1221 | case TemplateName::AssumedTemplate: { |
||
| 1222 | DeclarationName name = ( node.getAsAssumedTemplateName()->getDeclName() ); |
||
| 1223 | subW.find("name").writeDeclarationName(name); |
||
| 1224 | return; |
||
| 1225 | } |
||
| 1226 | |||
| 1227 | case TemplateName::QualifiedTemplate: { |
||
| 1228 | |||
| 1229 | auto qtn = node.getAsQualifiedTemplateName(); |
||
| 1230 | |||
| 1231 | NestedNameSpecifier * qualifier = ( qtn->getQualifier() ); |
||
| 1232 | subW.find("qualifier").writeNestedNameSpecifier(qualifier); |
||
| 1233 | bool hasTemplateKeyword = ( qtn->hasTemplateKeyword() ); |
||
| 1234 | subW.find("hasTemplateKeyword").writeBool(hasTemplateKeyword); |
||
| 1235 | TemplateName underlyingTemplateName = ( qtn->getUnderlyingTemplate() ); |
||
| 1236 | subW.find("underlyingTemplateName").writeTemplateName(underlyingTemplateName); |
||
| 1237 | return; |
||
| 1238 | } |
||
| 1239 | |||
| 1240 | case TemplateName::DependentTemplate: { |
||
| 1241 | |||
| 1242 | auto dtn = node.getAsDependentTemplateName(); |
||
| 1243 | |||
| 1244 | NestedNameSpecifier * qualifier = ( dtn->getQualifier() ); |
||
| 1245 | subW.find("qualifier").writeNestedNameSpecifier(qualifier); |
||
| 1246 | std::optional<const IdentifierInfo*> identifier = ( makeOptionalFromPointer( |
||
| 1247 | dtn->isIdentifier() |
||
| 1248 | ? dtn->getIdentifier() |
||
| 1249 | : nullptr) ); |
||
| 1250 | subW.find("identifier").writeOptional(identifier); |
||
| 1251 | if ( !identifier ) { |
||
| 1252 | OverloadedOperatorKind operatorKind = ( dtn->getOperator() ); |
||
| 1253 | subW.find("operatorKind").writeOverloadedOperatorKind(operatorKind); |
||
| 1254 | } |
||
| 1255 | return; |
||
| 1256 | } |
||
| 1257 | |||
| 1258 | case TemplateName::SubstTemplateTemplateParm: { |
||
| 1259 | |||
| 1260 | auto parm = node.getAsSubstTemplateTemplateParm(); |
||
| 1261 | |||
| 1262 | TemplateName replacement = ( parm->getReplacement() ); |
||
| 1263 | subW.find("replacement").writeTemplateName(replacement); |
||
| 1264 | const Decl* associatedDecl = ( parm->getAssociatedDecl() ); |
||
| 1265 | subW.find("associatedDecl").writeDeclRef(associatedDecl); |
||
| 1266 | uint32_t index = ( parm->getIndex() ); |
||
| 1267 | subW.find("index").writeUInt32(index); |
||
| 1268 | std::optional<uint32_t> packIndex = ( parm->getPackIndex() ); |
||
| 1269 | subW.find("packIndex").writeOptional(packIndex); |
||
| 1270 | return; |
||
| 1271 | } |
||
| 1272 | |||
| 1273 | case TemplateName::SubstTemplateTemplateParmPack: { |
||
| 1274 | |||
| 1275 | auto parm = node.getAsSubstTemplateTemplateParmPack(); |
||
| 1276 | |||
| 1277 | TemplateArgument argumentPack = ( parm->getArgumentPack() ); |
||
| 1278 | subW.find("argumentPack").writeTemplateArgument(argumentPack); |
||
| 1279 | const Decl* associatedDecl = ( parm->getAssociatedDecl() ); |
||
| 1280 | subW.find("associatedDecl").writeDeclRef(associatedDecl); |
||
| 1281 | uint32_t index = ( parm->getIndex() ); |
||
| 1282 | subW.find("index").writeUInt32(index); |
||
| 1283 | bool final = ( parm->getFinal() ); |
||
| 1284 | subW.find("final").writeBool(final); |
||
| 1285 | return; |
||
| 1286 | } |
||
| 1287 | |||
| 1288 | } |
||
| 1289 | llvm_unreachable("bad TemplateName::NameKind"); |
||
| 1290 | } |
||
| 1291 | void writeTemplateNameKind(TemplateName::NameKind value) { |
||
| 1292 | asImpl().writeEnum(value); |
||
| 1293 | } |
||
| 1294 | void writeTemplateTemplateParmDeclRef(const TemplateTemplateParmDecl* value) { |
||
| 1295 | asImpl().writeDeclRef(value); |
||
| 1296 | } |
||
| 1297 | void writeTemplateTypeParmDeclRef(const TemplateTypeParmDecl* value) { |
||
| 1298 | asImpl().writeDeclRef(value); |
||
| 1299 | } |
||
| 1300 | void writeTypeOfKind(TypeOfKind value) { |
||
| 1301 | asImpl().writeEnum(value); |
||
| 1302 | } |
||
| 1303 | void writeUnaryTypeTransformKind(UnaryTransformType::UTTKind value) { |
||
| 1304 | asImpl().writeEnum(value); |
||
| 1305 | } |
||
| 1306 | void writeUsingShadowDeclRef(const UsingShadowDecl* value) { |
||
| 1307 | asImpl().writeDeclRef(value); |
||
| 1308 | } |
||
| 1309 | void writeValueDeclRef(const ValueDecl* value) { |
||
| 1310 | asImpl().writeDeclRef(value); |
||
| 1311 | } |
||
| 1312 | void writeVectorKind(VectorType::VectorKind value) { |
||
| 1313 | asImpl().writeEnum(value); |
||
| 1314 | } |
||
| 1315 | }; |
||
| 1316 |