diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 4ee32c76a95d8..8ad0514ee2ce2 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -195,20 +195,25 @@ class ASTContext : public RefCountedBase { ConstantArrayTypes; mutable llvm::FoldingSet IncompleteArrayTypes; mutable std::vector VariableArrayTypes; - mutable llvm::FoldingSet DependentSizedArrayTypes; - mutable llvm::FoldingSet - DependentSizedExtVectorTypes; - mutable llvm::FoldingSet + mutable llvm::ContextualFoldingSet + DependentSizedArrayTypes; + mutable llvm::ContextualFoldingSet + DependentSizedExtVectorTypes; + mutable llvm::ContextualFoldingSet DependentAddressSpaceTypes; mutable llvm::FoldingSet VectorTypes; - mutable llvm::FoldingSet DependentVectorTypes; + mutable llvm::ContextualFoldingSet + DependentVectorTypes; mutable llvm::FoldingSet MatrixTypes; - mutable llvm::FoldingSet DependentSizedMatrixTypes; + mutable llvm::ContextualFoldingSet + DependentSizedMatrixTypes; mutable llvm::FoldingSet FunctionNoProtoTypes; mutable llvm::ContextualFoldingSet FunctionProtoTypes; - mutable llvm::FoldingSet DependentTypeOfExprTypes; - mutable llvm::FoldingSet DependentDecltypeTypes; + mutable llvm::ContextualFoldingSet + DependentTypeOfExprTypes; + mutable llvm::ContextualFoldingSet + DependentDecltypeTypes; mutable llvm::FoldingSet TemplateTypeParmTypes; mutable llvm::FoldingSet ObjCTypeParamTypes; mutable llvm::FoldingSet @@ -238,7 +243,8 @@ class ASTContext : public RefCountedBase { mutable llvm::FoldingSet AttributedTypes; mutable llvm::FoldingSet PipeTypes; mutable llvm::FoldingSet BitIntTypes; - mutable llvm::FoldingSet DependentBitIntTypes; + mutable llvm::ContextualFoldingSet + DependentBitIntTypes; llvm::FoldingSet BTFTagAttributedTypes; mutable llvm::FoldingSet QualifiedTemplateNames; diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index 4799f89db82fa..a78d8f60462b2 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -3289,8 +3289,6 @@ class VariableArrayType : public ArrayType { class DependentSizedArrayType : public ArrayType { friend class ASTContext; // ASTContext creates these. - const ASTContext &Context; - /// An assignment expression that will instantiate to the /// size of the array. /// @@ -3301,8 +3299,8 @@ class DependentSizedArrayType : public ArrayType { /// The range spanned by the left and right array brackets. SourceRange Brackets; - DependentSizedArrayType(const ASTContext &Context, QualType et, QualType can, - Expr *e, ArraySizeModifier sm, unsigned tq, + DependentSizedArrayType(QualType et, QualType can, Expr *e, + ArraySizeModifier sm, unsigned tq, SourceRange brackets); public: @@ -3325,7 +3323,7 @@ class DependentSizedArrayType : public ArrayType { return T->getTypeClass() == DependentSizedArray; } - void Profile(llvm::FoldingSetNodeID &ID) { + void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) { Profile(ID, Context, getElementType(), getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr()); } @@ -3349,14 +3347,12 @@ class DependentSizedArrayType : public ArrayType { class DependentAddressSpaceType : public Type, public llvm::FoldingSetNode { friend class ASTContext; - const ASTContext &Context; Expr *AddrSpaceExpr; QualType PointeeType; SourceLocation loc; - DependentAddressSpaceType(const ASTContext &Context, QualType PointeeType, - QualType can, Expr *AddrSpaceExpr, - SourceLocation loc); + DependentAddressSpaceType(QualType PointeeType, QualType can, + Expr *AddrSpaceExpr, SourceLocation loc); public: Expr *getAddrSpaceExpr() const { return AddrSpaceExpr; } @@ -3370,7 +3366,7 @@ class DependentAddressSpaceType : public Type, public llvm::FoldingSetNode { return T->getTypeClass() == DependentAddressSpace; } - void Profile(llvm::FoldingSetNodeID &ID) { + void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) { Profile(ID, Context, getPointeeType(), getAddrSpaceExpr()); } @@ -3391,7 +3387,6 @@ class DependentAddressSpaceType : public Type, public llvm::FoldingSetNode { class DependentSizedExtVectorType : public Type, public llvm::FoldingSetNode { friend class ASTContext; - const ASTContext &Context; Expr *SizeExpr; /// The element type of the array. @@ -3399,8 +3394,8 @@ class DependentSizedExtVectorType : public Type, public llvm::FoldingSetNode { SourceLocation loc; - DependentSizedExtVectorType(const ASTContext &Context, QualType ElementType, - QualType can, Expr *SizeExpr, SourceLocation loc); + DependentSizedExtVectorType(QualType ElementType, QualType can, + Expr *SizeExpr, SourceLocation loc); public: Expr *getSizeExpr() const { return SizeExpr; } @@ -3414,7 +3409,7 @@ class DependentSizedExtVectorType : public Type, public llvm::FoldingSetNode { return T->getTypeClass() == DependentSizedExtVector; } - void Profile(llvm::FoldingSetNodeID &ID) { + void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) { Profile(ID, Context, getElementType(), getSizeExpr()); } @@ -3513,14 +3508,12 @@ class VectorType : public Type, public llvm::FoldingSetNode { class DependentVectorType : public Type, public llvm::FoldingSetNode { friend class ASTContext; - const ASTContext &Context; QualType ElementType; Expr *SizeExpr; SourceLocation Loc; - DependentVectorType(const ASTContext &Context, QualType ElementType, - QualType CanonType, Expr *SizeExpr, - SourceLocation Loc, VectorType::VectorKind vecKind); + DependentVectorType(QualType ElementType, QualType CanonType, Expr *SizeExpr, + SourceLocation Loc, VectorType::VectorKind vecKind); public: Expr *getSizeExpr() const { return SizeExpr; } @@ -3537,7 +3530,7 @@ class DependentVectorType : public Type, public llvm::FoldingSetNode { return T->getTypeClass() == DependentVector; } - void Profile(llvm::FoldingSetNodeID &ID) { + void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) { Profile(ID, Context, getElementType(), getSizeExpr(), getVectorKind()); } @@ -3719,15 +3712,13 @@ class ConstantMatrixType final : public MatrixType { class DependentSizedMatrixType final : public MatrixType { friend class ASTContext; - const ASTContext &Context; Expr *RowExpr; Expr *ColumnExpr; SourceLocation loc; - DependentSizedMatrixType(const ASTContext &Context, QualType ElementType, - QualType CanonicalType, Expr *RowExpr, - Expr *ColumnExpr, SourceLocation loc); + DependentSizedMatrixType(QualType ElementType, QualType CanonicalType, + Expr *RowExpr, Expr *ColumnExpr, SourceLocation loc); public: Expr *getRowExpr() const { return RowExpr; } @@ -3738,7 +3729,7 @@ class DependentSizedMatrixType final : public MatrixType { return T->getTypeClass() == DependentSizedMatrix; } - void Profile(llvm::FoldingSetNodeID &ID) { + void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) { Profile(ID, Context, getElementType(), getRowExpr(), getColumnExpr()); } @@ -4749,15 +4740,12 @@ class TypeOfExprType : public Type { /// This class is used internally by the ASTContext to manage /// canonical, dependent types, only. Clients will only see instances /// of this class via TypeOfExprType nodes. -class DependentTypeOfExprType - : public TypeOfExprType, public llvm::FoldingSetNode { - const ASTContext &Context; - +class DependentTypeOfExprType : public TypeOfExprType, + public llvm::FoldingSetNode { public: - DependentTypeOfExprType(const ASTContext &Context, Expr *E, TypeOfKind Kind) - : TypeOfExprType(E, Kind), Context(Context) {} + DependentTypeOfExprType(Expr *E, TypeOfKind Kind) : TypeOfExprType(E, Kind) {} - void Profile(llvm::FoldingSetNodeID &ID) { + void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) { Profile(ID, Context, getUnderlyingExpr(), getKind() == TypeOfKind::Unqualified); } @@ -4833,12 +4821,10 @@ class DecltypeType : public Type { /// canonical, dependent types, only. Clients will only see instances /// of this class via DecltypeType nodes. class DependentDecltypeType : public DecltypeType, public llvm::FoldingSetNode { - const ASTContext &Context; - public: - DependentDecltypeType(const ASTContext &Context, Expr *E); + DependentDecltypeType(Expr *E, QualType UnderlyingTpe); - void Profile(llvm::FoldingSetNodeID &ID) { + void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) { Profile(ID, Context, getUnderlyingExpr()); } @@ -6657,12 +6643,10 @@ class BitIntType final : public Type, public llvm::FoldingSetNode { class DependentBitIntType final : public Type, public llvm::FoldingSetNode { friend class ASTContext; - const ASTContext &Context; llvm::PointerIntPair ExprAndUnsigned; protected: - DependentBitIntType(const ASTContext &Context, bool IsUnsigned, - Expr *NumBits); + DependentBitIntType(bool IsUnsigned, Expr *NumBits); public: bool isUnsigned() const; @@ -6672,7 +6656,7 @@ class DependentBitIntType final : public Type, public llvm::FoldingSetNode { bool isSugared() const { return false; } QualType desugar() const { return QualType(this, 0); } - void Profile(llvm::FoldingSetNodeID &ID) { + void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) { Profile(ID, Context, isUnsigned(), getNumBitsExpr()); } static void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index e3e4578ffd49e..cccff479c2c1c 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -925,6 +925,10 @@ ASTContext::ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins, TranslationUnitKind TUKind) : ConstantArrayTypes(this_(), ConstantArrayTypesLog2InitSize), + DependentSizedArrayTypes(this_()), DependentSizedExtVectorTypes(this_()), + DependentAddressSpaceTypes(this_()), DependentVectorTypes(this_()), + DependentSizedMatrixTypes(this_()), DependentTypeOfExprTypes(this_()), + DependentDecltypeTypes(this_()), DependentBitIntTypes(this_()), FunctionProtoTypes(this_(), FunctionProtoTypesLog2InitSize), TemplateSpecializationTypes(this_()), DependentTemplateSpecializationTypes(this_()), AutoTypes(this_()), @@ -3786,11 +3790,8 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, // initializer. We do no canonicalization here at all, which is okay // because they can't be used in most locations. if (!numElements) { - auto *newType - = new (*this, TypeAlignment) - DependentSizedArrayType(*this, elementType, QualType(), - numElements, ASM, elementTypeQuals, - brackets); + auto *newType = new (*this, TypeAlignment) DependentSizedArrayType( + elementType, QualType(), numElements, ASM, elementTypeQuals, brackets); Types.push_back(newType); return QualType(newType, 0); } @@ -3813,9 +3814,8 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, // If we don't have one, build one. if (!canonTy) { canonTy = new (*this, TypeAlignment) - DependentSizedArrayType(*this, QualType(canonElementType.Ty, 0), - QualType(), numElements, ASM, elementTypeQuals, - brackets); + DependentSizedArrayType(QualType(canonElementType.Ty, 0), QualType(), + numElements, ASM, elementTypeQuals, brackets); DependentSizedArrayTypes.InsertNode(canonTy, insertPos); Types.push_back(canonTy); } @@ -3832,10 +3832,8 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, // Otherwise, we need to build a type which follows the spelling // of the element type. - auto *sugaredType - = new (*this, TypeAlignment) - DependentSizedArrayType(*this, elementType, canon, numElements, - ASM, elementTypeQuals, brackets); + auto *sugaredType = new (*this, TypeAlignment) DependentSizedArrayType( + elementType, canon, numElements, ASM, elementTypeQuals, brackets); Types.push_back(sugaredType); return QualType(sugaredType, 0); } @@ -4111,12 +4109,12 @@ ASTContext::getDependentVectorType(QualType VecType, Expr *SizeExpr, if (Canon) { New = new (*this, TypeAlignment) DependentVectorType( - *this, VecType, QualType(Canon, 0), SizeExpr, AttrLoc, VecKind); + VecType, QualType(Canon, 0), SizeExpr, AttrLoc, VecKind); } else { QualType CanonVecTy = getCanonicalType(VecType); if (CanonVecTy == VecType) { - New = new (*this, TypeAlignment) DependentVectorType( - *this, VecType, QualType(), SizeExpr, AttrLoc, VecKind); + New = new (*this, TypeAlignment) + DependentVectorType(VecType, QualType(), SizeExpr, AttrLoc, VecKind); DependentVectorType *CanonCheck = DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos); @@ -4127,8 +4125,8 @@ ASTContext::getDependentVectorType(QualType VecType, Expr *SizeExpr, } else { QualType CanonTy = getDependentVectorType(CanonVecTy, SizeExpr, SourceLocation(), VecKind); - New = new (*this, TypeAlignment) DependentVectorType( - *this, VecType, CanonTy, SizeExpr, AttrLoc, VecKind); + New = new (*this, TypeAlignment) + DependentVectorType(VecType, CanonTy, SizeExpr, AttrLoc, VecKind); } } @@ -4186,15 +4184,13 @@ ASTContext::getDependentSizedExtVectorType(QualType vecType, if (Canon) { // We already have a canonical version of this array type; use it as // the canonical type for a newly-built type. - New = new (*this, TypeAlignment) - DependentSizedExtVectorType(*this, vecType, QualType(Canon, 0), - SizeExpr, AttrLoc); + New = new (*this, TypeAlignment) DependentSizedExtVectorType( + vecType, QualType(Canon, 0), SizeExpr, AttrLoc); } else { QualType CanonVecTy = getCanonicalType(vecType); if (CanonVecTy == vecType) { New = new (*this, TypeAlignment) - DependentSizedExtVectorType(*this, vecType, QualType(), SizeExpr, - AttrLoc); + DependentSizedExtVectorType(vecType, QualType(), SizeExpr, AttrLoc); DependentSizedExtVectorType *CanonCheck = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos); @@ -4204,8 +4200,8 @@ ASTContext::getDependentSizedExtVectorType(QualType vecType, } else { QualType CanonExtTy = getDependentSizedExtVectorType(CanonVecTy, SizeExpr, SourceLocation()); - New = new (*this, TypeAlignment) DependentSizedExtVectorType( - *this, vecType, CanonExtTy, SizeExpr, AttrLoc); + New = new (*this, TypeAlignment) + DependentSizedExtVectorType(vecType, CanonExtTy, SizeExpr, AttrLoc); } } @@ -4260,7 +4256,7 @@ QualType ASTContext::getDependentSizedMatrixType(QualType ElementTy, if (!Canon) { Canon = new (*this, TypeAlignment) DependentSizedMatrixType( - *this, CanonElementTy, QualType(), RowExpr, ColumnExpr, AttrLoc); + CanonElementTy, QualType(), RowExpr, ColumnExpr, AttrLoc); #ifndef NDEBUG DependentSizedMatrixType *CanonCheck = DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos); @@ -4279,7 +4275,7 @@ QualType ASTContext::getDependentSizedMatrixType(QualType ElementTy, // Use Canon as the canonical type for newly-built type. DependentSizedMatrixType *New = new (*this, TypeAlignment) - DependentSizedMatrixType(*this, ElementTy, QualType(Canon, 0), RowExpr, + DependentSizedMatrixType(ElementTy, QualType(Canon, 0), RowExpr, ColumnExpr, AttrLoc); Types.push_back(New); return QualType(New, 0); @@ -4301,9 +4297,8 @@ QualType ASTContext::getDependentAddressSpaceType(QualType PointeeType, DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos); if (!canonTy) { - canonTy = new (*this, TypeAlignment) - DependentAddressSpaceType(*this, canonPointeeType, - QualType(), AddrSpaceExpr, AttrLoc); + canonTy = new (*this, TypeAlignment) DependentAddressSpaceType( + canonPointeeType, QualType(), AddrSpaceExpr, AttrLoc); DependentAddressSpaceTypes.InsertNode(canonTy, insertPos); Types.push_back(canonTy); } @@ -4312,10 +4307,8 @@ QualType ASTContext::getDependentAddressSpaceType(QualType PointeeType, canonTy->getAddrSpaceExpr() == AddrSpaceExpr) return QualType(canonTy, 0); - auto *sugaredType - = new (*this, TypeAlignment) - DependentAddressSpaceType(*this, PointeeType, QualType(canonTy, 0), - AddrSpaceExpr, AttrLoc); + auto *sugaredType = new (*this, TypeAlignment) DependentAddressSpaceType( + PointeeType, QualType(canonTy, 0), AddrSpaceExpr, AttrLoc); Types.push_back(sugaredType); return QualType(sugaredType, 0); } @@ -4619,8 +4612,8 @@ QualType ASTContext::getDependentBitIntType(bool IsUnsigned, DependentBitIntTypes.FindNodeOrInsertPos(ID, InsertPos)) return QualType(Existing, 0); - auto *New = new (*this, TypeAlignment) - DependentBitIntType(*this, IsUnsigned, NumBitsExpr); + auto *New = + new (*this, TypeAlignment) DependentBitIntType(IsUnsigned, NumBitsExpr); DependentBitIntTypes.InsertNode(New, InsertPos); Types.push_back(New); @@ -5662,8 +5655,7 @@ QualType ASTContext::getTypeOfExprType(Expr *tofExpr, TypeOfKind Kind) const { TypeOfExprType(tofExpr, Kind, QualType((TypeOfExprType *)Canon, 0)); } else { // Build a new, canonical typeof(expr) type. - Canon = new (*this, TypeAlignment) - DependentTypeOfExprType(*this, tofExpr, Kind); + Canon = new (*this, TypeAlignment) DependentTypeOfExprType(tofExpr, Kind); DependentTypeOfExprTypes.InsertNode(Canon, InsertPos); toe = Canon; } @@ -5731,7 +5723,7 @@ QualType ASTContext::getDecltypeType(Expr *e, QualType UnderlyingType) const { = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos); if (!Canon) { // Build a new, canonical decltype(expr) type. - Canon = new (*this, TypeAlignment) DependentDecltypeType(*this, e); + Canon = new (*this, TypeAlignment) DependentDecltypeType(e, DependentTy); DependentDecltypeTypes.InsertNode(Canon, InsertPos); } dt = new (*this, TypeAlignment) diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index c08ebfb7f142b..4c433f7fe9dac 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -225,13 +225,12 @@ void ConstantArrayType::Profile(llvm::FoldingSetNodeID &ID, SizeExpr->Profile(ID, Context, true); } -DependentSizedArrayType::DependentSizedArrayType(const ASTContext &Context, - QualType et, QualType can, +DependentSizedArrayType::DependentSizedArrayType(QualType et, QualType can, Expr *e, ArraySizeModifier sm, unsigned tq, SourceRange brackets) - : ArrayType(DependentSizedArray, et, can, sm, tq, e), - Context(Context), SizeExpr((Stmt*) e), Brackets(brackets) {} + : ArrayType(DependentSizedArray, et, can, sm, tq, e), SizeExpr((Stmt *)e), + Brackets(brackets) {} void DependentSizedArrayType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, @@ -245,8 +244,7 @@ void DependentSizedArrayType::Profile(llvm::FoldingSetNodeID &ID, E->Profile(ID, Context, true); } -DependentVectorType::DependentVectorType(const ASTContext &Context, - QualType ElementType, +DependentVectorType::DependentVectorType(QualType ElementType, QualType CanonType, Expr *SizeExpr, SourceLocation Loc, VectorType::VectorKind VecKind) @@ -255,7 +253,7 @@ DependentVectorType::DependentVectorType(const ASTContext &Context, ElementType->getDependence() | (SizeExpr ? toTypeDependence(SizeExpr->getDependence()) : TypeDependence::None)), - Context(Context), ElementType(ElementType), SizeExpr(SizeExpr), Loc(Loc) { + ElementType(ElementType), SizeExpr(SizeExpr), Loc(Loc) { VectorTypeBits.VecKind = VecKind; } @@ -268,16 +266,16 @@ void DependentVectorType::Profile(llvm::FoldingSetNodeID &ID, SizeExpr->Profile(ID, Context, true); } -DependentSizedExtVectorType::DependentSizedExtVectorType( - const ASTContext &Context, QualType ElementType, QualType can, - Expr *SizeExpr, SourceLocation loc) +DependentSizedExtVectorType::DependentSizedExtVectorType(QualType ElementType, + QualType can, + Expr *SizeExpr, + SourceLocation loc) : Type(DependentSizedExtVector, can, TypeDependence::DependentInstantiation | ElementType->getDependence() | (SizeExpr ? toTypeDependence(SizeExpr->getDependence()) : TypeDependence::None)), - Context(Context), SizeExpr(SizeExpr), ElementType(ElementType), loc(loc) { -} + SizeExpr(SizeExpr), ElementType(ElementType), loc(loc) {} void DependentSizedExtVectorType::Profile(llvm::FoldingSetNodeID &ID, @@ -287,8 +285,7 @@ DependentSizedExtVectorType::Profile(llvm::FoldingSetNodeID &ID, SizeExpr->Profile(ID, Context, true); } -DependentAddressSpaceType::DependentAddressSpaceType(const ASTContext &Context, - QualType PointeeType, +DependentAddressSpaceType::DependentAddressSpaceType(QualType PointeeType, QualType can, Expr *AddrSpaceExpr, SourceLocation loc) @@ -297,8 +294,7 @@ DependentAddressSpaceType::DependentAddressSpaceType(const ASTContext &Context, PointeeType->getDependence() | (AddrSpaceExpr ? toTypeDependence(AddrSpaceExpr->getDependence()) : TypeDependence::None)), - Context(Context), AddrSpaceExpr(AddrSpaceExpr), PointeeType(PointeeType), - loc(loc) {} + AddrSpaceExpr(AddrSpaceExpr), PointeeType(PointeeType), loc(loc) {} void DependentAddressSpaceType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, @@ -337,12 +333,14 @@ ConstantMatrixType::ConstantMatrixType(TypeClass tc, QualType matrixType, : MatrixType(tc, matrixType, canonType), NumRows(nRows), NumColumns(nColumns) {} -DependentSizedMatrixType::DependentSizedMatrixType( - const ASTContext &CTX, QualType ElementType, QualType CanonicalType, - Expr *RowExpr, Expr *ColumnExpr, SourceLocation loc) +DependentSizedMatrixType::DependentSizedMatrixType(QualType ElementType, + QualType CanonicalType, + Expr *RowExpr, + Expr *ColumnExpr, + SourceLocation loc) : MatrixType(DependentSizedMatrix, ElementType, CanonicalType, RowExpr, ColumnExpr), - Context(CTX), RowExpr(RowExpr), ColumnExpr(ColumnExpr), loc(loc) {} + RowExpr(RowExpr), ColumnExpr(ColumnExpr), loc(loc) {} void DependentSizedMatrixType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &CTX, @@ -368,11 +366,10 @@ BitIntType::BitIntType(bool IsUnsigned, unsigned NumBits) : Type(BitInt, QualType{}, TypeDependence::None), IsUnsigned(IsUnsigned), NumBits(NumBits) {} -DependentBitIntType::DependentBitIntType(const ASTContext &Context, - bool IsUnsigned, Expr *NumBitsExpr) +DependentBitIntType::DependentBitIntType(bool IsUnsigned, Expr *NumBitsExpr) : Type(DependentBitInt, QualType{}, toTypeDependence(NumBitsExpr->getDependence())), - Context(Context), ExprAndUnsigned(NumBitsExpr, IsUnsigned) {} + ExprAndUnsigned(NumBitsExpr, IsUnsigned) {} bool DependentBitIntType::isUnsigned() const { return ExprAndUnsigned.getInt(); @@ -3726,8 +3723,8 @@ QualType DecltypeType::desugar() const { return QualType(this, 0); } -DependentDecltypeType::DependentDecltypeType(const ASTContext &Context, Expr *E) - : DecltypeType(E, Context.DependentTy), Context(Context) {} +DependentDecltypeType::DependentDecltypeType(Expr *E, QualType UnderlyingType) + : DecltypeType(E, UnderlyingType) {} void DependentDecltypeType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, Expr *E) {