Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/clang/AST/AbstractTypeReader.inc is written in an unsupported language. File is not indexed.

0001 /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
0002 |*                                                                            *|
0003 |* A CRTP reader for Clang Type nodes                                         *|
0004 |*                                                                            *|
0005 |* Automatically generated file, do not edit!                                 *|
0006 |* From: TypeProperties.td                                                    *|
0007 |*                                                                            *|
0008 \*===----------------------------------------------------------------------===*/
0009 
0010 template <class PropertyReader>
0011 class AbstractTypeReader {
0012 public:
0013   PropertyReader &R;
0014 
0015   AbstractTypeReader(PropertyReader &R) : R(R) {}
0016 
0017   QualType read(Type::TypeClass kind) {
0018     switch (kind) {
0019     case Type::Adjusted:
0020       return readAdjustedType();
0021     case Type::Decayed:
0022       return readDecayedType();
0023     case Type::ConstantArray:
0024       return readConstantArrayType();
0025     case Type::ArrayParameter:
0026       return readArrayParameterType();
0027     case Type::DependentSizedArray:
0028       return readDependentSizedArrayType();
0029     case Type::IncompleteArray:
0030       return readIncompleteArrayType();
0031     case Type::VariableArray:
0032       return readVariableArrayType();
0033     case Type::Atomic:
0034       return readAtomicType();
0035     case Type::Attributed:
0036       return readAttributedType();
0037     case Type::BTFTagAttributed:
0038       return readBTFTagAttributedType();
0039     case Type::BitInt:
0040       return readBitIntType();
0041     case Type::BlockPointer:
0042       return readBlockPointerType();
0043     case Type::CountAttributed:
0044       return readCountAttributedType();
0045     case Type::Builtin:
0046       return readBuiltinType();
0047     case Type::Complex:
0048       return readComplexType();
0049     case Type::Decltype:
0050       return readDecltypeType();
0051     case Type::Auto:
0052       return readAutoType();
0053     case Type::DeducedTemplateSpecialization:
0054       return readDeducedTemplateSpecializationType();
0055     case Type::DependentAddressSpace:
0056       return readDependentAddressSpaceType();
0057     case Type::DependentBitInt:
0058       return readDependentBitIntType();
0059     case Type::DependentName:
0060       return readDependentNameType();
0061     case Type::DependentSizedExtVector:
0062       return readDependentSizedExtVectorType();
0063     case Type::DependentTemplateSpecialization:
0064       return readDependentTemplateSpecializationType();
0065     case Type::DependentVector:
0066       return readDependentVectorType();
0067     case Type::Elaborated:
0068       return readElaboratedType();
0069     case Type::FunctionNoProto:
0070       return readFunctionNoProtoType();
0071     case Type::FunctionProto:
0072       return readFunctionProtoType();
0073     case Type::HLSLAttributedResource:
0074       return readHLSLAttributedResourceType();
0075     case Type::InjectedClassName:
0076       return readInjectedClassNameType();
0077     case Type::MacroQualified:
0078       return readMacroQualifiedType();
0079     case Type::ConstantMatrix:
0080       return readConstantMatrixType();
0081     case Type::DependentSizedMatrix:
0082       return readDependentSizedMatrixType();
0083     case Type::MemberPointer:
0084       return readMemberPointerType();
0085     case Type::ObjCObjectPointer:
0086       return readObjCObjectPointerType();
0087     case Type::ObjCObject:
0088       return readObjCObjectType();
0089     case Type::ObjCInterface:
0090       return readObjCInterfaceType();
0091     case Type::ObjCTypeParam:
0092       return readObjCTypeParamType();
0093     case Type::PackExpansion:
0094       return readPackExpansionType();
0095     case Type::PackIndexing:
0096       return readPackIndexingType();
0097     case Type::Paren:
0098       return readParenType();
0099     case Type::Pipe:
0100       return readPipeType();
0101     case Type::Pointer:
0102       return readPointerType();
0103     case Type::LValueReference:
0104       return readLValueReferenceType();
0105     case Type::RValueReference:
0106       return readRValueReferenceType();
0107     case Type::SubstTemplateTypeParmPack:
0108       return readSubstTemplateTypeParmPackType();
0109     case Type::SubstTemplateTypeParm:
0110       return readSubstTemplateTypeParmType();
0111     case Type::Enum:
0112       return readEnumType();
0113     case Type::Record:
0114       return readRecordType();
0115     case Type::TemplateSpecialization:
0116       return readTemplateSpecializationType();
0117     case Type::TemplateTypeParm:
0118       return readTemplateTypeParmType();
0119     case Type::TypeOfExpr:
0120       return readTypeOfExprType();
0121     case Type::TypeOf:
0122       return readTypeOfType();
0123     case Type::Typedef:
0124       return readTypedefType();
0125     case Type::UnaryTransform:
0126       return readUnaryTransformType();
0127     case Type::UnresolvedUsing:
0128       return readUnresolvedUsingType();
0129     case Type::Using:
0130       return readUsingType();
0131     case Type::Vector:
0132       return readVectorType();
0133     case Type::ExtVector:
0134       return readExtVectorType();
0135     }
0136     llvm_unreachable("bad kind");
0137   }
0138 
0139   QualType readAdjustedType() {
0140     auto &ctx = R.getASTContext();
0141     QualType originalType = R.find("originalType").readQualType();
0142     QualType adjustedType = R.find("adjustedType").readQualType();
0143      return ctx.getAdjustedType(originalType, adjustedType); 
0144   }
0145 
0146   QualType readDecayedType() {
0147     auto &ctx = R.getASTContext();
0148     QualType originalType = R.find("originalType").readQualType();
0149      return ctx.getAdjustedParameterType(originalType); 
0150   }
0151 
0152   QualType readConstantArrayType() {
0153     auto &ctx = R.getASTContext();
0154     llvm::APInt sizeValue = R.find("sizeValue").readAPInt();
0155     Expr* size = R.find("size").readExprRef();
0156     QualType elementType = R.find("elementType").readQualType();
0157     ArraySizeModifier sizeModifier = R.find("sizeModifier").readArraySizeModifier();
0158     Qualifiers indexQualifiers = R.find("indexQualifiers").readQualifiers();
0159     
0160     return ctx.getConstantArrayType(elementType, sizeValue, size,
0161                                     sizeModifier,
0162                                     indexQualifiers.getCVRQualifiers());
0163   
0164   }
0165 
0166   QualType readArrayParameterType() {
0167     auto &ctx = R.getASTContext();
0168     llvm::APInt sizeValue = R.find("sizeValue").readAPInt();
0169     Expr* size = R.find("size").readExprRef();
0170     QualType elementType = R.find("elementType").readQualType();
0171     ArraySizeModifier sizeModifier = R.find("sizeModifier").readArraySizeModifier();
0172     Qualifiers indexQualifiers = R.find("indexQualifiers").readQualifiers();
0173      return ctx.getAdjustedParameterType(
0174                               ctx.getConstantArrayType(elementType,sizeValue,
0175                                     size,sizeModifier,
0176                                     indexQualifiers.getCVRQualifiers())); 
0177   }
0178 
0179   QualType readDependentSizedArrayType() {
0180     auto &ctx = R.getASTContext();
0181     Expr* size = R.find("size").readExprRef();
0182     SourceLocation leftBracketLoc = R.find("leftBracketLoc").readSourceLocation();
0183     SourceLocation rightBracketLoc = R.find("rightBracketLoc").readSourceLocation();
0184     QualType elementType = R.find("elementType").readQualType();
0185     ArraySizeModifier sizeModifier = R.find("sizeModifier").readArraySizeModifier();
0186     Qualifiers indexQualifiers = R.find("indexQualifiers").readQualifiers();
0187     
0188     return ctx.getDependentSizedArrayType(elementType, size, sizeModifier,
0189                                           indexQualifiers.getCVRQualifiers(),
0190                                           SourceRange(leftBracketLoc,
0191                                                       rightBracketLoc));
0192   
0193   }
0194 
0195   QualType readIncompleteArrayType() {
0196     auto &ctx = R.getASTContext();
0197     QualType elementType = R.find("elementType").readQualType();
0198     ArraySizeModifier sizeModifier = R.find("sizeModifier").readArraySizeModifier();
0199     Qualifiers indexQualifiers = R.find("indexQualifiers").readQualifiers();
0200     
0201     return ctx.getIncompleteArrayType(elementType, sizeModifier,
0202                                       indexQualifiers.getCVRQualifiers());
0203   
0204   }
0205 
0206   QualType readVariableArrayType() {
0207     auto &ctx = R.getASTContext();
0208     SourceLocation leftBracketLoc = R.find("leftBracketLoc").readSourceLocation();
0209     SourceLocation rightBracketLoc = R.find("rightBracketLoc").readSourceLocation();
0210     Expr* size = R.find("size").readExprRef();
0211     QualType elementType = R.find("elementType").readQualType();
0212     ArraySizeModifier sizeModifier = R.find("sizeModifier").readArraySizeModifier();
0213     Qualifiers indexQualifiers = R.find("indexQualifiers").readQualifiers();
0214     
0215     return ctx.getVariableArrayType(elementType, size, sizeModifier,
0216                                     indexQualifiers.getCVRQualifiers(),
0217                                     SourceRange(leftBracketLoc,
0218                                                 rightBracketLoc));
0219   
0220   }
0221 
0222   QualType readAtomicType() {
0223     auto &ctx = R.getASTContext();
0224     QualType valueType = R.find("valueType").readQualType();
0225     
0226     return ctx.getAtomicType(valueType);
0227   
0228   }
0229 
0230   QualType readAttributedType() {
0231     auto &ctx = R.getASTContext();
0232     QualType modifiedType = R.find("modifiedType").readQualType();
0233     QualType equivalentType = R.find("equivalentType").readQualType();
0234     attr::Kind attrKind = R.find("attrKind").readAttrKind();
0235     const Attr * attribute = R.find("attribute").readAttr();
0236     
0237     return ctx.getAttributedType(attrKind, modifiedType,
0238                                  equivalentType, attribute);
0239   
0240   }
0241 
0242   QualType readBTFTagAttributedType() {
0243     auto &ctx = R.getASTContext();
0244     const BTFTypeTagAttr * attr = R.find("attr").readBTFTypeTagAttr();
0245     QualType wrappedType = R.find("wrappedType").readQualType();
0246     
0247     return ctx.getBTFTagAttributedType(attr, wrappedType);
0248   
0249   }
0250 
0251   QualType readBitIntType() {
0252     auto &ctx = R.getASTContext();
0253     bool isUnsigned = R.find("isUnsigned").readBool();
0254     uint32_t numBits = R.find("numBits").readUInt32();
0255     
0256     return ctx.getBitIntType(isUnsigned, numBits);
0257   
0258   }
0259 
0260   QualType readBlockPointerType() {
0261     auto &ctx = R.getASTContext();
0262     QualType pointeeType = R.find("pointeeType").readQualType();
0263      return ctx.getBlockPointerType(pointeeType); 
0264   }
0265 
0266   QualType readCountAttributedType() {
0267     auto &ctx = R.getASTContext();
0268     QualType WrappedTy = R.find("WrappedTy").readQualType();
0269     Expr* CountExpr = R.find("CountExpr").readExprRef();
0270     bool CountInBytes = R.find("CountInBytes").readBool();
0271     bool OrNull = R.find("OrNull").readBool();
0272     llvm::SmallVector<TypeCoupledDeclRefInfo, 8> CoupledDecls_buffer_0;
0273     llvm::ArrayRef<TypeCoupledDeclRefInfo> CoupledDecls = R.find("CoupledDecls").template readArray<TypeCoupledDeclRefInfo>(CoupledDecls_buffer_0);
0274      return ctx.getCountAttributedType(WrappedTy, CountExpr, CountInBytes, OrNull, CoupledDecls); 
0275   }
0276 
0277   QualType readBuiltinType() {
0278     auto &ctx = R.getASTContext();
0279     BuiltinType::Kind kind = R.find("kind").readBuiltinTypeKind();
0280     
0281       switch (kind) {
0282 #define IMAGE_TYPE(IMGTYPE, ID, SINGLETON_ID, ACCESS, SUFFIX) \
0283       case BuiltinType::ID: return ctx.SINGLETON_ID;
0284 #include "clang/Basic/OpenCLImageTypes.def"
0285 
0286 #define EXT_OPAQUE_TYPE(EXTTYPE, ID, EXT) \
0287       case BuiltinType::ID: return ctx.ID##Ty;
0288 #include "clang/Basic/OpenCLExtensionTypes.def"
0289 
0290 #define SVE_TYPE(NAME, ID, SINGLETON_ID) \
0291       case BuiltinType::ID: return ctx.SINGLETON_ID;
0292 #include "clang/Basic/AArch64SVEACLETypes.def"
0293 
0294 #define PPC_VECTOR_TYPE(NAME, ID, SIZE) \
0295       case BuiltinType::ID: return ctx.ID##Ty;
0296 #include "clang/Basic/PPCTypes.def"
0297 
0298 #define RVV_TYPE(NAME, ID, SINGLETON_ID) \
0299       case BuiltinType::ID: return ctx.SINGLETON_ID;
0300 #include "clang/Basic/RISCVVTypes.def"
0301 
0302 #define WASM_TYPE(NAME, ID, SINGLETON_ID) \
0303       case BuiltinType::ID: return ctx.SINGLETON_ID;
0304 #include "clang/Basic/WebAssemblyReferenceTypes.def"
0305 
0306 #define AMDGPU_TYPE(NAME, ID, SINGLETON_ID, WIDTH, ALIGN) \
0307       case BuiltinType::ID: return ctx.SINGLETON_ID;
0308 #include "clang/Basic/AMDGPUTypes.def"
0309 
0310 #define HLSL_INTANGIBLE_TYPE(NAME, ID, SINGLETON_ID) \
0311       case BuiltinType::ID: return ctx.SINGLETON_ID;
0312 #include "clang/Basic/HLSLIntangibleTypes.def"
0313 
0314 #define BUILTIN_TYPE(ID, SINGLETON_ID) \
0315       case BuiltinType::ID: return ctx.SINGLETON_ID;
0316 #include "clang/AST/BuiltinTypes.def"
0317       }
0318       llvm_unreachable("unreachable builtin case");
0319   
0320   }
0321 
0322   QualType readComplexType() {
0323     auto &ctx = R.getASTContext();
0324     QualType elementType = R.find("elementType").readQualType();
0325      return ctx.getComplexType(elementType); 
0326   }
0327 
0328   QualType readDecltypeType() {
0329     auto &ctx = R.getASTContext();
0330     QualType underlyingType = R.find("underlyingType").readQualType();
0331     Expr* expression = R.find("expression").readExprRef();
0332     
0333     return ctx.getDecltypeType(expression, underlyingType);
0334   
0335   }
0336 
0337   QualType readAutoType() {
0338     auto &ctx = R.getASTContext();
0339     std::optional<QualType> deducedType = R.find("deducedType").template readOptional<QualType>();
0340     AutoTypeKeyword keyword = R.find("keyword").readAutoTypeKeyword();
0341     std::optional<ConceptDecl*> typeConstraintConcept = R.find("typeConstraintConcept").template readOptional<ConceptDecl*>();
0342     llvm::SmallVector<TemplateArgument, 8> typeConstraintArguments_buffer_0;
0343     llvm::ArrayRef<TemplateArgument> typeConstraintArguments = R.find("typeConstraintArguments").template readArray<TemplateArgument>(typeConstraintArguments_buffer_0);
0344     uint32_t dependence = R.find("dependence").readUInt32();
0345     
0346     return ctx.getAutoType(makeNullableFromOptional(deducedType), keyword,
0347                            /*isDependentWithoutDeducedType*/ dependence > 0,
0348                            /*isPackWithoutDeducedType*/ dependence > 1,
0349                            makePointerFromOptional(typeConstraintConcept),
0350                            typeConstraintArguments);
0351   
0352   }
0353 
0354   QualType readDeducedTemplateSpecializationType() {
0355     auto &ctx = R.getASTContext();
0356     std::optional<TemplateName> templateName = R.find("templateName").template readOptional<TemplateName>();
0357     QualType deducedType = R.find("deducedType").readQualType();
0358     bool dependent = R.find("dependent").readBool();
0359     
0360     return ctx.getDeducedTemplateSpecializationType(
0361                                      makeNullableFromOptional(templateName),
0362                                      deducedType, dependent);
0363   
0364   }
0365 
0366   QualType readDependentAddressSpaceType() {
0367     auto &ctx = R.getASTContext();
0368     QualType pointeeType = R.find("pointeeType").readQualType();
0369     Expr* addressSpace = R.find("addressSpace").readExprRef();
0370     SourceLocation attributeLoc = R.find("attributeLoc").readSourceLocation();
0371     
0372     return ctx.getDependentAddressSpaceType(pointeeType, addressSpace,
0373                                             attributeLoc);
0374   
0375   }
0376 
0377   QualType readDependentBitIntType() {
0378     auto &ctx = R.getASTContext();
0379     bool isUnsigned = R.find("isUnsigned").readBool();
0380     Expr* numBitsExpr = R.find("numBitsExpr").readExprRef();
0381     
0382     return ctx.getDependentBitIntType(isUnsigned, numBitsExpr);
0383   
0384   }
0385 
0386   QualType readDependentNameType() {
0387     auto &ctx = R.getASTContext();
0388     ElaboratedTypeKeyword keyword = R.find("keyword").readElaboratedTypeKeyword();
0389     NestedNameSpecifier * qualifier = R.find("qualifier").readNestedNameSpecifier();
0390     IdentifierInfo* name = R.find("name").readIdentifier();
0391     std::optional<QualType> underlyingType = R.find("underlyingType").template readOptional<QualType>();
0392     
0393     QualType canon = (underlyingType
0394                         ? ctx.getCanonicalType(*underlyingType)
0395                         : QualType());
0396     return ctx.getDependentNameType(keyword, qualifier, name, canon);
0397   
0398   }
0399 
0400   QualType readDependentSizedExtVectorType() {
0401     auto &ctx = R.getASTContext();
0402     QualType elementType = R.find("elementType").readQualType();
0403     Expr* size = R.find("size").readExprRef();
0404     SourceLocation attributeLoc = R.find("attributeLoc").readSourceLocation();
0405     
0406     return ctx.getDependentSizedExtVectorType(elementType, size, attributeLoc);
0407   
0408   }
0409 
0410   QualType readDependentTemplateSpecializationType() {
0411     auto &ctx = R.getASTContext();
0412     ElaboratedTypeKeyword keyword = R.find("keyword").readElaboratedTypeKeyword();
0413     NestedNameSpecifier * qualifier = R.find("qualifier").readNestedNameSpecifier();
0414     IdentifierInfo* name = R.find("name").readIdentifier();
0415     llvm::SmallVector<TemplateArgument, 8> templateArguments_buffer_0;
0416     llvm::ArrayRef<TemplateArgument> templateArguments = R.find("templateArguments").template readArray<TemplateArgument>(templateArguments_buffer_0);
0417     
0418     return ctx.getDependentTemplateSpecializationType(keyword, qualifier,
0419                                                       name, templateArguments);
0420   
0421   }
0422 
0423   QualType readDependentVectorType() {
0424     auto &ctx = R.getASTContext();
0425     QualType elementType = R.find("elementType").readQualType();
0426     Expr* size = R.find("size").readExprRef();
0427     SourceLocation attributeLoc = R.find("attributeLoc").readSourceLocation();
0428     VectorKind vectorKind = R.find("vectorKind").readVectorKind();
0429     
0430     return ctx.getDependentVectorType(elementType, size, attributeLoc,
0431                                       vectorKind);
0432   
0433   }
0434 
0435   QualType readElaboratedType() {
0436     auto &ctx = R.getASTContext();
0437     ElaboratedTypeKeyword keyword = R.find("keyword").readElaboratedTypeKeyword();
0438     NestedNameSpecifier * qualifier = R.find("qualifier").readNestedNameSpecifier();
0439     QualType namedType = R.find("namedType").readQualType();
0440     std::optional<TagDecl*> ownedTag = R.find("ownedTag").template readOptional<TagDecl*>();
0441     
0442     return ctx.getElaboratedType(keyword, qualifier, namedType,
0443                                  makePointerFromOptional(ownedTag));
0444   
0445   }
0446 
0447   QualType readFunctionNoProtoType() {
0448     auto &ctx = R.getASTContext();
0449     QualType returnType = R.find("returnType").readQualType();
0450     bool noReturn = R.find("noReturn").readBool();
0451     bool hasRegParm = R.find("hasRegParm").readBool();
0452     uint32_t regParm = R.find("regParm").readUInt32();
0453     CallingConv callingConvention = R.find("callingConvention").readCallingConv();
0454     bool producesResult = R.find("producesResult").readBool();
0455     bool noCallerSavedRegs = R.find("noCallerSavedRegs").readBool();
0456     bool noCfCheck = R.find("noCfCheck").readBool();
0457     bool cmseNSCall = R.find("cmseNSCall").readBool();
0458     
0459     auto extInfo = FunctionType::ExtInfo(noReturn, hasRegParm, regParm,
0460                                          callingConvention, producesResult,
0461                                          noCallerSavedRegs, noCfCheck,
0462                                          cmseNSCall);
0463     return ctx.getFunctionNoProtoType(returnType, extInfo);
0464   
0465   }
0466 
0467   QualType readFunctionProtoType() {
0468     auto &ctx = R.getASTContext();
0469     bool variadic = R.find("variadic").readBool();
0470     bool trailingReturn = R.find("trailingReturn").readBool();
0471     Qualifiers methodQualifiers = R.find("methodQualifiers").readQualifiers();
0472     RefQualifierKind refQualifier = R.find("refQualifier").readRefQualifierKind();
0473     llvm::SmallVector<QualType, 8> exceptionSpecifier_buffer_0;
0474     FunctionProtoType::ExceptionSpecInfo exceptionSpecifier = R.find("exceptionSpecifier").readExceptionSpecInfo(exceptionSpecifier_buffer_0);
0475     llvm::SmallVector<QualType, 8> parameters_buffer_0;
0476     llvm::ArrayRef<QualType> parameters = R.find("parameters").template readArray<QualType>(parameters_buffer_0);
0477     llvm::SmallVector<FunctionProtoType::ExtParameterInfo, 8> extParameterInfo_buffer_0;
0478     llvm::ArrayRef<FunctionProtoType::ExtParameterInfo> extParameterInfo = R.find("extParameterInfo").template readArray<FunctionProtoType::ExtParameterInfo>(extParameterInfo_buffer_0);
0479     uint32_t AArch64SMEAttributes = R.find("AArch64SMEAttributes").readUInt32();
0480     llvm::SmallVector<FunctionEffect, 8> functionEffects_buffer_0;
0481     llvm::ArrayRef<FunctionEffect> functionEffects = R.find("functionEffects").template readArray<FunctionEffect>(functionEffects_buffer_0);
0482     llvm::SmallVector<EffectConditionExpr, 8> functionEffectConds_buffer_0;
0483     llvm::ArrayRef<EffectConditionExpr> functionEffectConds = R.find("functionEffectConds").template readArray<EffectConditionExpr>(functionEffectConds_buffer_0);
0484     QualType returnType = R.find("returnType").readQualType();
0485     bool noReturn = R.find("noReturn").readBool();
0486     bool hasRegParm = R.find("hasRegParm").readBool();
0487     uint32_t regParm = R.find("regParm").readUInt32();
0488     CallingConv callingConvention = R.find("callingConvention").readCallingConv();
0489     bool producesResult = R.find("producesResult").readBool();
0490     bool noCallerSavedRegs = R.find("noCallerSavedRegs").readBool();
0491     bool noCfCheck = R.find("noCfCheck").readBool();
0492     bool cmseNSCall = R.find("cmseNSCall").readBool();
0493     
0494     auto extInfo = FunctionType::ExtInfo(noReturn, hasRegParm, regParm,
0495                                          callingConvention, producesResult,
0496                                          noCallerSavedRegs, noCfCheck,
0497                                          cmseNSCall);
0498     FunctionProtoType::ExtProtoInfo epi;
0499     epi.ExtInfo = extInfo;
0500     epi.Variadic = variadic;
0501     epi.HasTrailingReturn = trailingReturn;
0502     epi.TypeQuals = methodQualifiers;
0503     epi.RefQualifier = refQualifier;
0504     epi.ExceptionSpec = exceptionSpecifier;
0505     epi.ExtParameterInfos =
0506       extParameterInfo.empty() ? nullptr : extParameterInfo.data();
0507     epi.AArch64SMEAttributes = AArch64SMEAttributes;
0508     epi.FunctionEffects = FunctionEffectsRef::create(functionEffects, functionEffectConds);
0509     return ctx.getFunctionType(returnType, parameters, epi);
0510   
0511   }
0512 
0513   QualType readHLSLAttributedResourceType() {
0514     auto &ctx = R.getASTContext();
0515     uint32_t resClass = R.find("resClass").readUInt32();
0516     bool isROV = R.find("isROV").readBool();
0517     bool rawBuffer = R.find("rawBuffer").readBool();
0518     QualType wrappedTy = R.find("wrappedTy").readQualType();
0519     QualType containedTy = R.find("containedTy").readQualType();
0520     
0521     HLSLAttributedResourceType::Attributes attrs(static_cast<llvm::dxil::ResourceClass>(resClass), isROV, rawBuffer);
0522     return ctx.getHLSLAttributedResourceType(wrappedTy, containedTy, attrs);
0523   
0524   }
0525 
0526   QualType readInjectedClassNameType() {
0527     auto &ctx = R.getASTContext();
0528     Decl* declaration = R.find("declaration").readDeclRef();
0529     QualType injectedSpecializationType = R.find("injectedSpecializationType").readQualType();
0530     
0531     // FIXME: ASTContext::getInjectedClassNameType is not currently suitable
0532     // for AST reading, too much interdependencies.
0533     const Type *T = nullptr;
0534     auto typeDecl = cast<CXXRecordDecl>(declaration);
0535     for (auto *DI = typeDecl; DI; DI = DI->getPreviousDecl()) {
0536       if (const Type *existing = DI->getTypeForDecl()) {
0537         T = existing;
0538         break;
0539       }
0540     }
0541     if (!T) {
0542       T = new (ctx, TypeAlignment)
0543             InjectedClassNameType(typeDecl, injectedSpecializationType);
0544       for (auto *DI = typeDecl; DI; DI = DI->getPreviousDecl())
0545         DI->setTypeForDecl(T);
0546     }
0547     return QualType(T, 0);
0548   
0549   }
0550 
0551   QualType readMacroQualifiedType() {
0552     auto &ctx = R.getASTContext();
0553     QualType underlyingType = R.find("underlyingType").readQualType();
0554     IdentifierInfo* macroIdentifier = R.find("macroIdentifier").readIdentifier();
0555     
0556     return ctx.getMacroQualifiedType(underlyingType, macroIdentifier);
0557   
0558   }
0559 
0560   QualType readConstantMatrixType() {
0561     auto &ctx = R.getASTContext();
0562     uint32_t numRows = R.find("numRows").readUInt32();
0563     uint32_t numColumns = R.find("numColumns").readUInt32();
0564     QualType elementType = R.find("elementType").readQualType();
0565     
0566     return ctx.getConstantMatrixType(elementType, numRows, numColumns);
0567   
0568   }
0569 
0570   QualType readDependentSizedMatrixType() {
0571     auto &ctx = R.getASTContext();
0572     Expr* rows = R.find("rows").readExprRef();
0573     Expr* columns = R.find("columns").readExprRef();
0574     SourceLocation attributeLoc = R.find("attributeLoc").readSourceLocation();
0575     QualType elementType = R.find("elementType").readQualType();
0576     
0577     return ctx.getDependentSizedMatrixType(elementType, rows, columns, attributeLoc);
0578   
0579   }
0580 
0581   QualType readMemberPointerType() {
0582     auto &ctx = R.getASTContext();
0583     QualType pointeeType = R.find("pointeeType").readQualType();
0584     QualType baseType = R.find("baseType").readQualType();
0585     
0586     return ctx.getMemberPointerType(pointeeType, baseType.getTypePtr());
0587   
0588   }
0589 
0590   QualType readObjCObjectPointerType() {
0591     auto &ctx = R.getASTContext();
0592     QualType pointeeType = R.find("pointeeType").readQualType();
0593     
0594     return ctx.getObjCObjectPointerType(pointeeType);
0595   
0596   }
0597 
0598   QualType readObjCObjectType() {
0599     auto &ctx = R.getASTContext();
0600     QualType baseType = R.find("baseType").readQualType();
0601     llvm::SmallVector<QualType, 8> typeArgsAsWritten_buffer_0;
0602     llvm::ArrayRef<QualType> typeArgsAsWritten = R.find("typeArgsAsWritten").template readArray<QualType>(typeArgsAsWritten_buffer_0);
0603     llvm::SmallVector<ObjCProtocolDecl*, 8> qualifiers_buffer_0;
0604     llvm::ArrayRef<ObjCProtocolDecl*> qualifiers = R.find("qualifiers").template readArray<ObjCProtocolDecl*>(qualifiers_buffer_0);
0605     bool isKindOfTypeAsWritten = R.find("isKindOfTypeAsWritten").readBool();
0606     
0607     return ctx.getObjCObjectType(baseType, typeArgsAsWritten, qualifiers,
0608                                  isKindOfTypeAsWritten);
0609   
0610   }
0611 
0612   QualType readObjCInterfaceType() {
0613     auto &ctx = R.getASTContext();
0614     Decl* declaration = R.find("declaration").readDeclRef();
0615     
0616     return ctx.getObjCInterfaceType(
0617              cast<ObjCInterfaceDecl>(declaration->getCanonicalDecl()));
0618   
0619   }
0620 
0621   QualType readObjCTypeParamType() {
0622     auto &ctx = R.getASTContext();
0623     ObjCTypeParamDecl* declaration = R.find("declaration").readObjCTypeParamDeclRef();
0624     llvm::SmallVector<ObjCProtocolDecl*, 8> qualifiers_buffer_0;
0625     llvm::ArrayRef<ObjCProtocolDecl*> qualifiers = R.find("qualifiers").template readArray<ObjCProtocolDecl*>(qualifiers_buffer_0);
0626     
0627     return ctx.getObjCTypeParamType(declaration, qualifiers);
0628   
0629   }
0630 
0631   QualType readPackExpansionType() {
0632     auto &ctx = R.getASTContext();
0633     QualType pattern = R.find("pattern").readQualType();
0634     std::optional<uint32_t> numExpansions = R.find("numExpansions").template readOptional<uint32_t>();
0635     
0636     return ctx.getPackExpansionType(pattern, numExpansions,
0637                                     /*ExpectPackInType*/false);
0638   
0639   }
0640 
0641   QualType readPackIndexingType() {
0642     auto &ctx = R.getASTContext();
0643     QualType pattern = R.find("pattern").readQualType();
0644     Expr* indexExpression = R.find("indexExpression").readExprRef();
0645     bool isFullySubstituted = R.find("isFullySubstituted").readBool();
0646     
0647     return ctx.getPackIndexingType(pattern, indexExpression, isFullySubstituted);
0648   
0649   }
0650 
0651   QualType readParenType() {
0652     auto &ctx = R.getASTContext();
0653     QualType innerType = R.find("innerType").readQualType();
0654     
0655     return ctx.getParenType(innerType);
0656   
0657   }
0658 
0659   QualType readPipeType() {
0660     auto &ctx = R.getASTContext();
0661     QualType elementType = R.find("elementType").readQualType();
0662     bool isReadOnly = R.find("isReadOnly").readBool();
0663     
0664     return ctx.getPipeType(elementType, isReadOnly);
0665   
0666   }
0667 
0668   QualType readPointerType() {
0669     auto &ctx = R.getASTContext();
0670     QualType pointeeType = R.find("pointeeType").readQualType();
0671      return ctx.getPointerType(pointeeType); 
0672   }
0673 
0674   QualType readLValueReferenceType() {
0675     auto &ctx = R.getASTContext();
0676     bool isSpelledAsLValue = R.find("isSpelledAsLValue").readBool();
0677     QualType pointeeTypeAsWritten = R.find("pointeeTypeAsWritten").readQualType();
0678     
0679     return ctx.getLValueReferenceType(pointeeTypeAsWritten,
0680                                       isSpelledAsLValue);
0681   
0682   }
0683 
0684   QualType readRValueReferenceType() {
0685     auto &ctx = R.getASTContext();
0686     QualType pointeeTypeAsWritten = R.find("pointeeTypeAsWritten").readQualType();
0687     
0688     return ctx.getRValueReferenceType(pointeeTypeAsWritten);
0689   
0690   }
0691 
0692   QualType readSubstTemplateTypeParmPackType() {
0693     auto &ctx = R.getASTContext();
0694     Decl* associatedDecl = R.find("associatedDecl").readDeclRef();
0695     uint32_t Index = R.find("Index").readUInt32();
0696     bool Final = R.find("Final").readBool();
0697     TemplateArgument replacementPack = R.find("replacementPack").readTemplateArgument();
0698     
0699     return ctx.getSubstTemplateTypeParmPackType(
0700                         associatedDecl, Index, Final, replacementPack);
0701   
0702   }
0703 
0704   QualType readSubstTemplateTypeParmType() {
0705     auto &ctx = R.getASTContext();
0706     QualType replacementType = R.find("replacementType").readQualType();
0707     Decl* associatedDecl = R.find("associatedDecl").readDeclRef();
0708     uint32_t Index = R.find("Index").readUInt32();
0709     std::optional<uint32_t> PackIndex = R.find("PackIndex").template readOptional<uint32_t>();
0710     SubstTemplateTypeParmTypeFlag SubstitutionFlag = R.find("SubstitutionFlag").readSubstTemplateTypeParmTypeFlag();
0711     
0712     return ctx.getSubstTemplateTypeParmType(
0713         replacementType, associatedDecl, Index, PackIndex, SubstitutionFlag);
0714   
0715   }
0716 
0717   QualType readEnumType() {
0718     auto &ctx = R.getASTContext();
0719     bool dependent = R.find("dependent").readBool();
0720     Decl* declaration = R.find("declaration").readDeclRef();
0721     
0722     QualType result = ctx.getEnumType(cast<EnumDecl>(declaration));
0723     if (dependent)
0724       const_cast<Type *>(result.getTypePtr())
0725           ->addDependence(TypeDependence::DependentInstantiation);
0726     return result;
0727   
0728   }
0729 
0730   QualType readRecordType() {
0731     auto &ctx = R.getASTContext();
0732     bool dependent = R.find("dependent").readBool();
0733     Decl* declaration = R.find("declaration").readDeclRef();
0734     
0735     auto record = cast<RecordDecl>(declaration);
0736     QualType result = ctx.getRecordType(record);
0737     if (dependent)
0738       const_cast<Type *>(result.getTypePtr())
0739           ->addDependence(TypeDependence::DependentInstantiation);
0740     return result;
0741   
0742   }
0743 
0744   QualType readTemplateSpecializationType() {
0745     auto &ctx = R.getASTContext();
0746     bool dependent = R.find("dependent").readBool();
0747     TemplateName templateName = R.find("templateName").readTemplateName();
0748     llvm::SmallVector<TemplateArgument, 8> templateArguments_buffer_0;
0749     llvm::ArrayRef<TemplateArgument> templateArguments = R.find("templateArguments").template readArray<TemplateArgument>(templateArguments_buffer_0);
0750     std::optional<QualType> underlyingType = R.find("underlyingType").template readOptional<QualType>();
0751     
0752     QualType result;
0753     if (!underlyingType) {
0754       result = ctx.getCanonicalTemplateSpecializationType(templateName,
0755                                                           templateArguments);
0756     } else {
0757       result = ctx.getTemplateSpecializationType(templateName,
0758                                                  templateArguments,
0759                                                  *underlyingType);
0760     }
0761     if (dependent)
0762       const_cast<Type *>(result.getTypePtr())
0763           ->addDependence(TypeDependence::DependentInstantiation);
0764     return result;
0765   
0766   }
0767 
0768   QualType readTemplateTypeParmType() {
0769     auto &ctx = R.getASTContext();
0770     uint32_t depth = R.find("depth").readUInt32();
0771     uint32_t index = R.find("index").readUInt32();
0772     bool isParameterPack = R.find("isParameterPack").readBool();
0773     std::optional<TemplateTypeParmDecl*> declaration = R.find("declaration").template readOptional<TemplateTypeParmDecl*>();
0774     
0775     return ctx.getTemplateTypeParmType(depth, index, isParameterPack,
0776                                        makePointerFromOptional(declaration));
0777   
0778   }
0779 
0780   QualType readTypeOfExprType() {
0781     auto &ctx = R.getASTContext();
0782     Expr* expression = R.find("expression").readExprRef();
0783     TypeOfKind kind = R.find("kind").readTypeOfKind();
0784     
0785     return ctx.getTypeOfExprType(expression, kind);
0786   
0787   }
0788 
0789   QualType readTypeOfType() {
0790     auto &ctx = R.getASTContext();
0791     QualType unmodifiedType = R.find("unmodifiedType").readQualType();
0792     TypeOfKind kind = R.find("kind").readTypeOfKind();
0793     
0794     return ctx.getTypeOfType(unmodifiedType, kind);
0795   
0796   }
0797 
0798   QualType readTypedefType() {
0799     auto &ctx = R.getASTContext();
0800     Decl* declaration = R.find("declaration").readDeclRef();
0801     QualType underlyingType = R.find("underlyingType").readQualType();
0802     
0803     return ctx.getTypedefType(cast<TypedefNameDecl>(declaration), underlyingType);
0804   
0805   }
0806 
0807   QualType readUnaryTransformType() {
0808     auto &ctx = R.getASTContext();
0809     QualType baseType = R.find("baseType").readQualType();
0810     QualType underlyingType = R.find("underlyingType").readQualType();
0811     UnaryTransformType::UTTKind transform = R.find("transform").readUnaryTypeTransformKind();
0812     
0813     return ctx.getUnaryTransformType(baseType, underlyingType, transform);
0814   
0815   }
0816 
0817   QualType readUnresolvedUsingType() {
0818     auto &ctx = R.getASTContext();
0819     Decl* declaration = R.find("declaration").readDeclRef();
0820     
0821     return ctx.getUnresolvedUsingType(cast<UnresolvedUsingTypenameDecl>(declaration));
0822   
0823   }
0824 
0825   QualType readUsingType() {
0826     auto &ctx = R.getASTContext();
0827     UsingShadowDecl* foundDeclaration = R.find("foundDeclaration").readUsingShadowDeclRef();
0828     QualType underlyingType = R.find("underlyingType").readQualType();
0829     
0830     return ctx.getUsingType(foundDeclaration, underlyingType);
0831   
0832   }
0833 
0834   QualType readVectorType() {
0835     auto &ctx = R.getASTContext();
0836     QualType elementType = R.find("elementType").readQualType();
0837     uint32_t numElements = R.find("numElements").readUInt32();
0838     VectorKind vectorKind = R.find("vectorKind").readVectorKind();
0839     
0840     return ctx.getVectorType(elementType, numElements, vectorKind);
0841   
0842   }
0843 
0844   QualType readExtVectorType() {
0845     auto &ctx = R.getASTContext();
0846     QualType elementType = R.find("elementType").readQualType();
0847     uint32_t numElements = R.find("numElements").readUInt32();
0848     
0849     return ctx.getExtVectorType(elementType, numElements);
0850   
0851   }
0852 
0853 };
0854