diff --git a/include/swift/AST/Attr.h b/include/swift/AST/Attr.h index 63152ff76a5ec..47b013e4140ce 100644 --- a/include/swift/AST/Attr.h +++ b/include/swift/AST/Attr.h @@ -2962,7 +2962,7 @@ class AllowFeatureSuppressionAttr final ArrayRef getSuppressedFeatures() const { return {getTrailingObjects(), - Bits.AllowFeatureSuppressionAttr.NumFeatures}; + static_cast(Bits.AllowFeatureSuppressionAttr.NumFeatures)}; } static bool classof(const DeclAttribute *DA) { diff --git a/include/swift/AST/Decl.h b/include/swift/AST/Decl.h index 10121e8071e12..980be00680074 100644 --- a/include/swift/AST/Decl.h +++ b/include/swift/AST/Decl.h @@ -8672,7 +8672,7 @@ class EnumCaseDecl final : public Decl, /// Get the list of elements declared in this case. ArrayRef getElements() const { return {getTrailingObjects(), - Bits.EnumCaseDecl.NumElements}; + static_cast(Bits.EnumCaseDecl.NumElements)}; } SourceRange getSourceRange() const; diff --git a/include/swift/AST/Expr.h b/include/swift/AST/Expr.h index f34ffc15db38e..6de922e90d634 100644 --- a/include/swift/AST/Expr.h +++ b/include/swift/AST/Expr.h @@ -2453,10 +2453,10 @@ class CollectionExpr : public Expr { /// Retrieve the elements stored in the collection. ArrayRef getElements() const { - return {getTrailingObjectsPointer(), Bits.CollectionExpr.NumSubExprs}; + return {getTrailingObjectsPointer(), static_cast(Bits.CollectionExpr.NumSubExprs)}; } MutableArrayRef getElements() { - return {getTrailingObjectsPointer(), Bits.CollectionExpr.NumSubExprs}; + return {getTrailingObjectsPointer(), static_cast(Bits.CollectionExpr.NumSubExprs)}; } Expr *getElement(unsigned i) const { return getElements()[i]; } void setElement(unsigned i, Expr *E) { getElements()[i] = E; } @@ -3517,7 +3517,7 @@ class ErasureExpr final : public ImplicitConversionExpr, /// that corresponding protocol). ArrayRef getConformances() const { return {getTrailingObjects(), - Bits.ErasureExpr.NumConformances }; + static_cast(Bits.ErasureExpr.NumConformances) }; } /// Retrieve the conversion expressions mapping requirements from any @@ -3719,7 +3719,7 @@ class UnresolvedSpecializeExpr final : public Expr, /// been bound to archetypes of the entity to be specialized. ArrayRef getUnresolvedParams() const { return {getTrailingObjects(), - Bits.UnresolvedSpecializeExpr.NumUnresolvedParams}; + static_cast(Bits.UnresolvedSpecializeExpr.NumUnresolvedParams)}; } SourceLoc getLoc() const { return LAngleLoc; } @@ -3989,11 +3989,11 @@ class SequenceExpr final : public Expr, unsigned getNumElements() const { return Bits.SequenceExpr.NumElements; } MutableArrayRef getElements() { - return {getTrailingObjects(), Bits.SequenceExpr.NumElements}; + return {getTrailingObjects(), static_cast(Bits.SequenceExpr.NumElements)}; } ArrayRef getElements() const { - return {getTrailingObjects(), Bits.SequenceExpr.NumElements}; + return {getTrailingObjects(), static_cast(Bits.SequenceExpr.NumElements)}; } Expr *getElement(unsigned i) const { @@ -4592,7 +4592,7 @@ class CaptureListExpr final : public Expr, ArrayRef getCaptureList() { return {getTrailingObjects(), - Bits.CaptureListExpr.NumCaptures}; + static_cast(Bits.CaptureListExpr.NumCaptures)}; } AbstractClosureExpr *getClosureBody() { return closureBody; } const AbstractClosureExpr *getClosureBody() const { return closureBody; } diff --git a/include/swift/AST/Stmt.h b/include/swift/AST/Stmt.h index dc394216e08ee..d27bb5ea695e4 100644 --- a/include/swift/AST/Stmt.h +++ b/include/swift/AST/Stmt.h @@ -212,12 +212,12 @@ class BraceStmt final : public Stmt, /// The elements contained within the BraceStmt. MutableArrayRef getElements() { - return {getTrailingObjects(), Bits.BraceStmt.NumElements}; + return {getTrailingObjects(), static_cast(Bits.BraceStmt.NumElements)}; } /// The elements contained within the BraceStmt (const version). ArrayRef getElements() const { - return {getTrailingObjects(), Bits.BraceStmt.NumElements}; + return {getTrailingObjects(), static_cast(Bits.BraceStmt.NumElements)}; } ASTNode findAsyncNode(); @@ -330,10 +330,10 @@ class YieldStmt final SourceLoc getEndLoc() const; ArrayRef getYields() const { - return {getTrailingObjects(), Bits.YieldStmt.NumYields}; + return {getTrailingObjects(), static_cast(Bits.YieldStmt.NumYields)}; } MutableArrayRef getMutableYields() { - return {getTrailingObjects(), Bits.YieldStmt.NumYields}; + return {getTrailingObjects(), static_cast(Bits.YieldStmt.NumYields)}; } static bool classof(const Stmt *S) { return S->getKind() == StmtKind::Yield; } @@ -1259,11 +1259,11 @@ class CaseStmt final } ArrayRef getCaseLabelItems() const { - return {getTrailingObjects(), Bits.CaseStmt.NumPatterns}; + return {getTrailingObjects(), static_cast(Bits.CaseStmt.NumPatterns)}; } MutableArrayRef getMutableCaseLabelItems() { - return {getTrailingObjects(), Bits.CaseStmt.NumPatterns}; + return {getTrailingObjects(), static_cast(Bits.CaseStmt.NumPatterns)}; } unsigned getNumCaseLabelItems() const { return Bits.CaseStmt.NumPatterns; } @@ -1448,7 +1448,7 @@ class SwitchStmt final : public LabeledStmt, void setSubjectExpr(Expr *e) { SubjectExpr = e; } ArrayRef getRawCases() const { - return {getTrailingObjects(), Bits.SwitchStmt.CaseCount}; + return {getTrailingObjects(), static_cast(Bits.SwitchStmt.CaseCount)}; } private: @@ -1541,10 +1541,10 @@ class DoCatchStmt final void setBody(Stmt *s) { Body = s; } ArrayRef getCatches() const { - return {getTrailingObjects(), Bits.DoCatchStmt.NumCatches}; + return {getTrailingObjects(), static_cast(Bits.DoCatchStmt.NumCatches)}; } MutableArrayRef getMutableCatches() { - return {getTrailingObjects(), Bits.DoCatchStmt.NumCatches}; + return {getTrailingObjects(), static_cast(Bits.DoCatchStmt.NumCatches)}; } /// Retrieve the complete set of branches for this do-catch statement. diff --git a/include/swift/AST/TypeRepr.h b/include/swift/AST/TypeRepr.h index e6082dc295d2c..d18c62a544a96 100644 --- a/include/swift/AST/TypeRepr.h +++ b/include/swift/AST/TypeRepr.h @@ -917,7 +917,7 @@ class TupleTypeRepr final : public TypeRepr, ArrayRef getElements() const { return { getTrailingObjects(), - Bits.TupleTypeRepr.NumElements }; + static_cast(Bits.TupleTypeRepr.NumElements) }; } void getElementTypes(SmallVectorImpl &Types) const { @@ -1003,7 +1003,7 @@ class CompositionTypeRepr final : public TypeRepr, public: ArrayRef getTypes() const { - return {getTrailingObjects(), Bits.CompositionTypeRepr.NumTypes}; + return {getTrailingObjects(), static_cast(Bits.CompositionTypeRepr.NumTypes)}; } SourceLoc getSourceLoc() const { return FirstTypeLoc; } SourceRange getCompositionRange() const { return CompositionRange; } @@ -1494,7 +1494,7 @@ class SILBoxTypeRepr final : public TypeRepr, ArrayRef getFields() const { return {getTrailingObjects(), - Bits.SILBoxTypeRepr.NumFields}; + static_cast(Bits.SILBoxTypeRepr.NumFields)}; } ArrayRef getGenericArguments() const { return {getTrailingObjects(), diff --git a/include/swift/AST/Types.h b/include/swift/AST/Types.h index 14195f16ed191..7ae6766315793 100644 --- a/include/swift/AST/Types.h +++ b/include/swift/AST/Types.h @@ -2824,7 +2824,7 @@ class BoundGenericType : public NominalOrBoundGenericNominalType, /// Retrieve the set of generic arguments provided at this level. ArrayRef getGenericArgs() const { - return {getTrailingObjectsPointer(), Bits.BoundGenericType.GenericArgCount}; + return {getTrailingObjectsPointer(), static_cast(Bits.BoundGenericType.GenericArgCount)}; } SmallVector getExpandedGenericArgs(); @@ -6365,7 +6365,7 @@ class ProtocolCompositionType final : public TypeBase, /// a protocol composition type; you also have to look at /// hasExplicitAnyObject(). ArrayRef getMembers() const { - return {getTrailingObjects(), Bits.ProtocolCompositionType.Count}; + return {getTrailingObjects(), static_cast(Bits.ProtocolCompositionType.Count)}; } InvertibleProtocolSet getInverses() const { return Inverses; } @@ -6463,7 +6463,7 @@ class ParameterizedProtocolType final : public TypeBase, ArrayRef getArgs() const { return {getTrailingObjects(), - Bits.ParameterizedProtocolType.ArgCount}; + static_cast(Bits.ParameterizedProtocolType.ArgCount)}; } bool requiresClass() const { @@ -7513,7 +7513,7 @@ class ErrorUnionType final static Type get(const ASTContext &ctx, ArrayRef terms); ArrayRef getTerms() const { - return { getTrailingObjects(), Bits.ErrorUnionType.NumTerms }; + return { getTrailingObjects(), static_cast(Bits.ErrorUnionType.NumTerms) }; }; // Support for FoldingSet. diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index 2d5cbbe154f42..2de0f3b1e1204 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -771,7 +771,7 @@ CaseStmt::CaseStmt(CaseParentKind parentKind, SourceLoc itemIntroducerLoc, } MutableArrayRef items{getTrailingObjects(), - Bits.CaseStmt.NumPatterns}; + static_cast(Bits.CaseStmt.NumPatterns)}; // At the beginning mark all of our var decls as being owned by this // statement. In the typechecker we wireup the case stmt var decl list since