/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Helper classes for BasicWriters *| |* *| |* Automatically generated file, do not edit! *| |* From: PropertiesBase.td *| |* *| \*===----------------------------------------------------------------------===*/ template struct WriteDispatcher; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeAPInt(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeAPSInt(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeAPValue(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeAPValueKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeArraySizeModifier(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeAttrKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeAutoTypeKeyword(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeBTFTypeTagAttr(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeBool(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeBuiltinTypeKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeCXXRecordDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeCXXRecordDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeCallingConv(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeConceptDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeConceptDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeDeclarationName(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeDeclarationNameKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeEffectConditionExpr(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeElaboratedTypeKeyword(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeExceptionSpecInfo(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeExprRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeExprRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeExtParameterInfo(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeFixedPointSemantics(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeFunctionDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeFunctionDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeFunctionEffect(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeIdentifier(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeIdentifier(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeLValuePathEntry(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeLValuePathSerializationHelper(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeNamedDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeNamedDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeNamespaceAliasDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeNamespaceAliasDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeNamespaceDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeNamespaceDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeNestedNameSpecifier(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeNestedNameSpecifierKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeObjCProtocolDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeObjCProtocolDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeObjCTypeParamDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeObjCTypeParamDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeOverloadedOperatorKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeQualType(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeQualifiers(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeRefQualifierKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeSelector(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeSourceLocation(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeStmtRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeStmtRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTagDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTagDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTemplateArgument(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTemplateArgumentKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTemplateDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTemplateDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTemplateName(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTemplateNameKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTemplateTemplateParmDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTemplateTemplateParmDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTemplateTypeParmDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTemplateTypeParmDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTypeCoupledDeclRefInfo(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeTypeOfKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeUInt32(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeUInt64(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeUnaryTypeTransformKind(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeUsingShadowDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeUsingShadowDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeValueDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeValueDeclRef(std::forward(args)...); } }; template <> struct WriteDispatcher { template static void write(BasicWriter &W, Args &&... args) { return W.writeVectorKind(std::forward(args)...); } }; template struct WriteDispatcher> { template static void write(BasicWriter &W, Args &&... args) { return W.writeArray(std::forward(args)...); } }; template struct WriteDispatcher> { template static void write(BasicWriter &W, Args &&... args) { return W.writeOptional(std::forward(args)...); } }; template struct PackOptionalValue; template <> struct PackOptionalValue { static CXXRecordDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const CXXRecordDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static ConceptDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const ConceptDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static Decl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const Decl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static Expr* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const Expr* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static FunctionDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const FunctionDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static IdentifierInfo* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const IdentifierInfo* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static NamedDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const NamedDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static NamespaceAliasDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const NamespaceAliasDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static NamespaceDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const NamespaceDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static ObjCProtocolDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const ObjCProtocolDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static ObjCTypeParamDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const ObjCTypeParamDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static QualType pack(std::optional value) { return value ? *value : QualType(); } }; template <> struct PackOptionalValue { static Stmt* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const Stmt* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static TagDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const TagDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static TemplateDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const TemplateDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static TemplateName pack(std::optional value) { return value ? *value : TemplateName(); } }; template <> struct PackOptionalValue { static TemplateTemplateParmDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const TemplateTemplateParmDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static TemplateTypeParmDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const TemplateTypeParmDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static uint32_t pack(std::optional value) { return value ? *value + 1 : 0; } }; template <> struct PackOptionalValue { static uint64_t pack(std::optional value) { return value ? *value + 1 : 0; } }; template <> struct PackOptionalValue { static UsingShadowDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const UsingShadowDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static ValueDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template <> struct PackOptionalValue { static const ValueDecl* pack(std::optional value) { return value ? *value : nullptr; } }; template class BasicWriterBase { ASTContext &C; protected: BasicWriterBase(ASTContext &ctx) : C(ctx) {} public: ASTContext &getASTContext() { return C; } Impl &asImpl() { return static_cast(*this); } void writeAPValue(const APValue & node) { auto &&subW = asImpl().writeObject(); APValue::ValueKind kind = (node.getKind()); subW.find("kind").writeAPValueKind(kind); switch (kind) { case APValue::None: { return; } case APValue::Indeterminate: { return; } case APValue::Int: { llvm::APSInt value = ( node.getInt() ); subW.find("value").writeAPSInt(value); return; } case APValue::Float: { uint32_t semantics = ( static_cast( llvm::APFloatBase::SemanticsToEnum(node.getFloat().getSemantics())) ); subW.find("semantics").writeUInt32(semantics); llvm::APInt value = ( node.getFloat().bitcastToAPInt() ); subW.find("value").writeAPInt(value); return; } case APValue::FixedPoint: { llvm::FixedPointSemantics semantics = ( node.getFixedPoint().getSemantics() ); subW.find("semantics").writeFixedPointSemantics(semantics); llvm::APSInt value = ( node.getFixedPoint().getValue() ); subW.find("value").writeAPSInt(value); return; } case APValue::ComplexInt: { llvm::APSInt real = ( node.getComplexIntReal() ); subW.find("real").writeAPSInt(real); llvm::APSInt imag = ( node.getComplexIntImag() ); subW.find("imag").writeAPSInt(imag); return; } case APValue::ComplexFloat: { auto sema = llvm::APFloatBase::SemanticsToEnum( node.getComplexFloatReal().getSemantics()); assert(sema == llvm::APFloatBase::SemanticsToEnum( node.getComplexFloatImag().getSemantics())); uint32_t semantics = ( static_cast(sema) ); subW.find("semantics").writeUInt32(semantics); llvm::APInt real = ( node.getComplexFloatReal().bitcastToAPInt() ); subW.find("real").writeAPInt(real); llvm::APInt imag = ( node.getComplexFloatImag().bitcastToAPInt() ); subW.find("imag").writeAPInt(imag); return; } case APValue::Vector: { SmallVector buffer; unsigned len = node.getVectorLength(); for (unsigned i = 0; i < len; ++i) buffer.push_back(node.getVectorElt(i)); llvm::ArrayRef elements = ( buffer ); subW.find("elements").writeArray(elements); return; } case APValue::Array: { SmallVector buffer{}; unsigned initLength = node.getArrayInitializedElts(); for (unsigned i = 0; i < initLength; ++i) buffer.push_back(node.getArrayInitializedElt(i)); if (node.hasArrayFiller()) buffer.push_back(node.getArrayFiller()); uint32_t totalLength = ( node.getArraySize() ); subW.find("totalLength").writeUInt32(totalLength); bool hasFiller = ( node.hasArrayFiller() ); subW.find("hasFiller").writeBool(hasFiller); llvm::ArrayRef elements = ( buffer ); subW.find("elements").writeArray(elements); return; } case APValue::Struct: { SmallVector structBases; unsigned numBases = node.getStructNumBases(); for (unsigned i = 0; i < numBases; ++i) structBases.push_back(node.getStructBase(i)); SmallVector structFields; unsigned numFields = node.getStructNumFields(); for (unsigned i = 0; i < numFields; ++i) structFields.push_back(node.getStructField(i)); llvm::ArrayRef bases = ( structBases ); subW.find("bases").writeArray(bases); llvm::ArrayRef fields = ( structFields ); subW.find("fields").writeArray(fields); return; } case APValue::Union: { const Decl* fieldDecl = ( node.getUnionField() ); subW.find("fieldDecl").writeDeclRef(fieldDecl); APValue value = ( node.getUnionValue() ); subW.find("value").writeAPValue(value); return; } case APValue::AddrLabelDiff: { const Stmt* lhs = ( const_cast(node.getAddrLabelDiffLHS()) ); subW.find("lhs").writeStmtRef(lhs); const Stmt* rhs = ( const_cast(node.getAddrLabelDiffRHS()) ); subW.find("rhs").writeStmtRef(rhs); return; } case APValue::MemberPointer: { bool isDerived = ( node.isMemberPointerToDerivedMember() ); subW.find("isDerived").writeBool(isDerived); const ValueDecl* member = ( node.getMemberPointerDecl() ); subW.find("member").writeValueDeclRef(member); llvm::ArrayRef memberPath = ( node.getMemberPointerPath() ); subW.find("memberPath").writeArray(memberPath); return; } case APValue::LValue: { auto lvalueBase = node.getLValueBase(); const Expr *expr = lvalueBase ? lvalueBase.dyn_cast() : nullptr; bool lvalueBaseIsExpr = (bool) expr; bool lvalueBaseIsTypeInfo = lvalueBase.is(); bool lvalueBaseIsDynamicAlloc = lvalueBase.is(); QualType elemTy; if (lvalueBase) { if (lvalueBaseIsTypeInfo) { elemTy = lvalueBase.getTypeInfoType(); } else if (lvalueBaseIsDynamicAlloc) { elemTy = lvalueBase.getDynamicAllocType(); } else if (lvalueBaseIsExpr) { elemTy = expr->getType(); } else { elemTy = lvalueBase.get()->getType(); } } bool hasLValuePath = ( node.hasLValuePath() ); subW.find("hasLValuePath").writeBool(hasLValuePath); bool isLValueOnePastTheEnd = ( node.isLValueOnePastTheEnd() ); subW.find("isLValueOnePastTheEnd").writeBool(isLValueOnePastTheEnd); bool isExpr = ( lvalueBaseIsExpr ); subW.find("isExpr").writeBool(isExpr); bool isTypeInfo = ( lvalueBaseIsTypeInfo ); subW.find("isTypeInfo").writeBool(isTypeInfo); bool isDynamicAlloc = ( lvalueBaseIsDynamicAlloc ); subW.find("isDynamicAlloc").writeBool(isDynamicAlloc); bool hasBase = ( static_cast(lvalueBase) ); subW.find("hasBase").writeBool(hasBase); bool isNullPtr = ( node.isNullPointer() ); subW.find("isNullPtr").writeBool(isNullPtr); if ( hasBase && isTypeInfo ) { QualType typeInfo = ( QualType(node.getLValueBase().get().getType(), 0) ); subW.find("typeInfo").writeQualType(typeInfo); } if ( hasBase && isDynamicAlloc ) { uint32_t dynamicAlloc = ( node.getLValueBase().get().getIndex() ); subW.find("dynamicAlloc").writeUInt32(dynamicAlloc); } if ( hasBase && (isTypeInfo || isDynamicAlloc) ) { QualType type = ( isTypeInfo ? node.getLValueBase().getTypeInfoType() : node.getLValueBase().getDynamicAllocType() ); subW.find("type").writeQualType(type); } if ( hasBase && !isTypeInfo ) { uint32_t callIndex = ( node.getLValueBase().getCallIndex() ); subW.find("callIndex").writeUInt32(callIndex); } if ( hasBase && !isTypeInfo ) { uint32_t version = ( node.getLValueBase().getVersion() ); subW.find("version").writeUInt32(version); } if ( hasBase && !isTypeInfo && isExpr ) { const Stmt* stmt = ( const_cast(expr) ); subW.find("stmt").writeStmtRef(stmt); } if ( hasBase && !isTypeInfo && !isDynamicAlloc && !isExpr ) { const Decl* decl = ( lvalueBase.get() ); subW.find("decl").writeDeclRef(decl); } uint32_t offsetQuantity = ( node.getLValueOffset().getQuantity() ); subW.find("offsetQuantity").writeUInt32(offsetQuantity); if ( hasLValuePath ) { APValue::LValuePathSerializationHelper lvaluePath = ( APValue::LValuePathSerializationHelper(node.getLValuePath(), elemTy) ); subW.find("lvaluePath").writeLValuePathSerializationHelper(lvaluePath); } return; } } llvm_unreachable("bad APValue::ValueKind"); } void writeAPValueKind(APValue::ValueKind value) { asImpl().writeEnum(value); } void writeArraySizeModifier(ArraySizeModifier value) { asImpl().writeEnum(value); } void writeAttrKind(attr::Kind value) { asImpl().writeEnum(value); } void writeAutoTypeKeyword(AutoTypeKeyword value) { asImpl().writeEnum(value); } void writeBuiltinTypeKind(BuiltinType::Kind value) { asImpl().writeEnum(value); } void writeCXXRecordDeclRef(const CXXRecordDecl* value) { asImpl().writeDeclRef(value); } void writeCallingConv(CallingConv value) { asImpl().writeEnum(value); } void writeConceptDeclRef(const ConceptDecl* value) { asImpl().writeDeclRef(value); } void writeDeclarationName(DeclarationName node) { auto &&subW = asImpl().writeObject(); DeclarationName::NameKind kind = (node.getNameKind()); subW.find("kind").writeDeclarationNameKind(kind); switch (kind) { case DeclarationName::Identifier: { const IdentifierInfo* identifier = ( node.getAsIdentifierInfo() ); subW.find("identifier").writeIdentifier(identifier); return; } case DeclarationName::ObjCZeroArgSelector: { Selector selector = ( node.getObjCSelector() ); subW.find("selector").writeSelector(selector); return; } case DeclarationName::ObjCOneArgSelector: { Selector selector = ( node.getObjCSelector() ); subW.find("selector").writeSelector(selector); return; } case DeclarationName::ObjCMultiArgSelector: { Selector selector = ( node.getObjCSelector() ); subW.find("selector").writeSelector(selector); return; } case DeclarationName::CXXConstructorName: { QualType type = ( node.getCXXNameType() ); subW.find("type").writeQualType(type); return; } case DeclarationName::CXXDestructorName: { QualType type = ( node.getCXXNameType() ); subW.find("type").writeQualType(type); return; } case DeclarationName::CXXConversionFunctionName: { QualType type = ( node.getCXXNameType() ); subW.find("type").writeQualType(type); return; } case DeclarationName::CXXDeductionGuideName: { const TemplateDecl* declaration = ( node.getCXXDeductionGuideTemplate() ); subW.find("declaration").writeTemplateDeclRef(declaration); return; } case DeclarationName::CXXOperatorName: { OverloadedOperatorKind operatorKind = ( node.getCXXOverloadedOperator() ); subW.find("operatorKind").writeOverloadedOperatorKind(operatorKind); return; } case DeclarationName::CXXLiteralOperatorName: { const IdentifierInfo* identifier = ( node.getCXXLiteralIdentifier() ); subW.find("identifier").writeIdentifier(identifier); return; } case DeclarationName::CXXUsingDirective: { return; } } llvm_unreachable("bad DeclarationName::NameKind"); } void writeDeclarationNameKind(DeclarationName::NameKind value) { asImpl().writeEnum(value); } void writeElaboratedTypeKeyword(ElaboratedTypeKeyword value) { asImpl().writeEnum(value); } void writeExprRef(const Expr* value) { asImpl().writeStmtRef(value); } void writeFunctionDeclRef(const FunctionDecl* value) { asImpl().writeDeclRef(value); } void writeNamedDeclRef(const NamedDecl* value) { asImpl().writeDeclRef(value); } void writeNamespaceAliasDeclRef(const NamespaceAliasDecl* value) { asImpl().writeDeclRef(value); } void writeNamespaceDeclRef(const NamespaceDecl* value) { asImpl().writeDeclRef(value); } void writeNestedNameSpecifierKind(NestedNameSpecifier::SpecifierKind value) { asImpl().writeEnum(value); } void writeObjCProtocolDeclRef(const ObjCProtocolDecl* value) { asImpl().writeDeclRef(value); } void writeObjCTypeParamDeclRef(const ObjCTypeParamDecl* value) { asImpl().writeDeclRef(value); } void writeOverloadedOperatorKind(OverloadedOperatorKind value) { asImpl().writeEnum(value); } void writeRefQualifierKind(RefQualifierKind value) { asImpl().writeEnum(value); } void writeTagDeclRef(const TagDecl* value) { asImpl().writeDeclRef(value); } void writeTemplateArgument(TemplateArgument node) { auto &&subW = asImpl().writeObject(); TemplateArgument::ArgKind kind = (node.getKind()); subW.find("kind").writeTemplateArgumentKind(kind); switch (kind) { case TemplateArgument::Null: { return; } case TemplateArgument::Type: { QualType type = ( node.getAsType() ); subW.find("type").writeQualType(type); bool isDefaulted = ( node.getIsDefaulted() ); subW.find("isDefaulted").writeBool(isDefaulted); return; } case TemplateArgument::Declaration: { const ValueDecl* declaration = ( node.getAsDecl() ); subW.find("declaration").writeValueDeclRef(declaration); QualType parameterType = ( node.getParamTypeForDecl() ); subW.find("parameterType").writeQualType(parameterType); bool isDefaulted = ( node.getIsDefaulted() ); subW.find("isDefaulted").writeBool(isDefaulted); return; } case TemplateArgument::NullPtr: { QualType type = ( node.getNullPtrType() ); subW.find("type").writeQualType(type); bool isDefaulted = ( node.getIsDefaulted() ); subW.find("isDefaulted").writeBool(isDefaulted); return; } case TemplateArgument::Integral: { llvm::APSInt value = ( node.getAsIntegral() ); subW.find("value").writeAPSInt(value); QualType type = ( node.getIntegralType() ); subW.find("type").writeQualType(type); bool isDefaulted = ( node.getIsDefaulted() ); subW.find("isDefaulted").writeBool(isDefaulted); return; } case TemplateArgument::StructuralValue: { APValue value = ( node.getAsStructuralValue() ); subW.find("value").writeAPValue(value); QualType type = ( node.getStructuralValueType() ); subW.find("type").writeQualType(type); bool isDefaulted = ( node.getIsDefaulted() ); subW.find("isDefaulted").writeBool(isDefaulted); return; } case TemplateArgument::Template: { TemplateName name = ( node.getAsTemplateOrTemplatePattern() ); subW.find("name").writeTemplateName(name); bool isDefaulted = ( node.getIsDefaulted() ); subW.find("isDefaulted").writeBool(isDefaulted); return; } case TemplateArgument::TemplateExpansion: { TemplateName name = ( node.getAsTemplateOrTemplatePattern() ); subW.find("name").writeTemplateName(name); std::optional numExpansions = ( // Translate unsigned -> uint32_t just in case. llvm::transformOptional(node.getNumTemplateExpansions(), [](unsigned i) { return uint32_t(i); }) ); subW.find("numExpansions").writeOptional(numExpansions); bool isDefaulted = ( node.getIsDefaulted() ); subW.find("isDefaulted").writeBool(isDefaulted); return; } case TemplateArgument::Expression: { const Expr* expression = ( node.getAsExpr() ); subW.find("expression").writeExprRef(expression); bool isDefaulted = ( node.getIsDefaulted() ); subW.find("isDefaulted").writeBool(isDefaulted); return; } case TemplateArgument::Pack: { llvm::ArrayRef elements = ( node.pack_elements() ); subW.find("elements").writeArray(elements); return; } } llvm_unreachable("bad TemplateArgument::ArgKind"); } void writeTemplateArgumentKind(TemplateArgument::ArgKind value) { asImpl().writeEnum(value); } void writeTemplateDeclRef(const TemplateDecl* value) { asImpl().writeDeclRef(value); } void writeTemplateName(TemplateName node) { auto &&subW = asImpl().writeObject(); TemplateName::NameKind kind = (node.getKind()); subW.find("kind").writeTemplateNameKind(kind); switch (kind) { case TemplateName::Template: { const TemplateDecl* declaration = ( node.getAsTemplateDecl() ); subW.find("declaration").writeTemplateDeclRef(declaration); return; } case TemplateName::UsingTemplate: { const UsingShadowDecl* foundDecl = ( node.getAsUsingShadowDecl() ); subW.find("foundDecl").writeUsingShadowDeclRef(foundDecl); return; } case TemplateName::OverloadedTemplate: { llvm::ArrayRef overloads = ( node.getAsOverloadedTemplate()->decls() ); subW.find("overloads").writeArray(overloads); return; } case TemplateName::AssumedTemplate: { DeclarationName name = ( node.getAsAssumedTemplateName()->getDeclName() ); subW.find("name").writeDeclarationName(name); return; } case TemplateName::QualifiedTemplate: { auto qtn = node.getAsQualifiedTemplateName(); NestedNameSpecifier * qualifier = ( qtn->getQualifier() ); subW.find("qualifier").writeNestedNameSpecifier(qualifier); bool hasTemplateKeyword = ( qtn->hasTemplateKeyword() ); subW.find("hasTemplateKeyword").writeBool(hasTemplateKeyword); TemplateName underlyingTemplateName = ( qtn->getUnderlyingTemplate() ); subW.find("underlyingTemplateName").writeTemplateName(underlyingTemplateName); return; } case TemplateName::DependentTemplate: { auto dtn = node.getAsDependentTemplateName(); NestedNameSpecifier * qualifier = ( dtn->getQualifier() ); subW.find("qualifier").writeNestedNameSpecifier(qualifier); std::optional identifier = ( makeOptionalFromPointer( dtn->isIdentifier() ? dtn->getIdentifier() : nullptr) ); subW.find("identifier").writeOptional(identifier); if ( !identifier ) { OverloadedOperatorKind operatorKind = ( dtn->getOperator() ); subW.find("operatorKind").writeOverloadedOperatorKind(operatorKind); } return; } case TemplateName::SubstTemplateTemplateParm: { auto parm = node.getAsSubstTemplateTemplateParm(); TemplateName replacement = ( parm->getReplacement() ); subW.find("replacement").writeTemplateName(replacement); const Decl* associatedDecl = ( parm->getAssociatedDecl() ); subW.find("associatedDecl").writeDeclRef(associatedDecl); uint32_t index = ( parm->getIndex() ); subW.find("index").writeUInt32(index); std::optional packIndex = ( parm->getPackIndex() ); subW.find("packIndex").writeOptional(packIndex); return; } case TemplateName::SubstTemplateTemplateParmPack: { auto parm = node.getAsSubstTemplateTemplateParmPack(); TemplateArgument argumentPack = ( parm->getArgumentPack() ); subW.find("argumentPack").writeTemplateArgument(argumentPack); const Decl* associatedDecl = ( parm->getAssociatedDecl() ); subW.find("associatedDecl").writeDeclRef(associatedDecl); uint32_t index = ( parm->getIndex() ); subW.find("index").writeUInt32(index); bool final = ( parm->getFinal() ); subW.find("final").writeBool(final); return; } } llvm_unreachable("bad TemplateName::NameKind"); } void writeTemplateNameKind(TemplateName::NameKind value) { asImpl().writeEnum(value); } void writeTemplateTemplateParmDeclRef(const TemplateTemplateParmDecl* value) { asImpl().writeDeclRef(value); } void writeTemplateTypeParmDeclRef(const TemplateTypeParmDecl* value) { asImpl().writeDeclRef(value); } void writeTypeOfKind(TypeOfKind value) { asImpl().writeEnum(value); } void writeUnaryTypeTransformKind(UnaryTransformType::UTTKind value) { asImpl().writeEnum(value); } void writeUsingShadowDeclRef(const UsingShadowDecl* value) { asImpl().writeDeclRef(value); } void writeValueDeclRef(const ValueDecl* value) { asImpl().writeDeclRef(value); } void writeVectorKind(VectorKind value) { asImpl().writeEnum(value); } };