Skip to content

Commit 3745dd1

Browse files
Merge pull request #79340 from kateinoigakukun/pr-3e00aa82837cda0d107594c8b38a7446d55c768b
2 parents c42268e + c047870 commit 3745dd1

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

include/swift/AST/Attr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2962,7 +2962,7 @@ class AllowFeatureSuppressionAttr final
29622962

29632963
ArrayRef<Identifier> getSuppressedFeatures() const {
29642964
return {getTrailingObjects<Identifier>(),
2965-
Bits.AllowFeatureSuppressionAttr.NumFeatures};
2965+
static_cast<size_t>(Bits.AllowFeatureSuppressionAttr.NumFeatures)};
29662966
}
29672967

29682968
static bool classof(const DeclAttribute *DA) {

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8676,7 +8676,7 @@ class EnumCaseDecl final : public Decl,
86768676
/// Get the list of elements declared in this case.
86778677
ArrayRef<EnumElementDecl *> getElements() const {
86788678
return {getTrailingObjects<EnumElementDecl *>(),
8679-
Bits.EnumCaseDecl.NumElements};
8679+
static_cast<size_t>(Bits.EnumCaseDecl.NumElements)};
86808680
}
86818681
SourceRange getSourceRange() const;
86828682

include/swift/AST/Expr.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2455,10 +2455,10 @@ class CollectionExpr : public Expr {
24552455

24562456
/// Retrieve the elements stored in the collection.
24572457
ArrayRef<Expr *> getElements() const {
2458-
return {getTrailingObjectsPointer(), Bits.CollectionExpr.NumSubExprs};
2458+
return {getTrailingObjectsPointer(), static_cast<size_t>(Bits.CollectionExpr.NumSubExprs)};
24592459
}
24602460
MutableArrayRef<Expr *> getElements() {
2461-
return {getTrailingObjectsPointer(), Bits.CollectionExpr.NumSubExprs};
2461+
return {getTrailingObjectsPointer(), static_cast<size_t>(Bits.CollectionExpr.NumSubExprs)};
24622462
}
24632463
Expr *getElement(unsigned i) const { return getElements()[i]; }
24642464
void setElement(unsigned i, Expr *E) { getElements()[i] = E; }
@@ -3519,7 +3519,7 @@ class ErasureExpr final : public ImplicitConversionExpr,
35193519
/// that corresponding protocol).
35203520
ArrayRef<ProtocolConformanceRef> getConformances() const {
35213521
return {getTrailingObjects<ProtocolConformanceRef>(),
3522-
Bits.ErasureExpr.NumConformances };
3522+
static_cast<size_t>(Bits.ErasureExpr.NumConformances) };
35233523
}
35243524

35253525
/// Retrieve the conversion expressions mapping requirements from any
@@ -3721,7 +3721,7 @@ class UnresolvedSpecializeExpr final : public Expr,
37213721
/// been bound to archetypes of the entity to be specialized.
37223722
ArrayRef<TypeRepr *> getUnresolvedParams() const {
37233723
return {getTrailingObjects<TypeRepr *>(),
3724-
Bits.UnresolvedSpecializeExpr.NumUnresolvedParams};
3724+
static_cast<size_t>(Bits.UnresolvedSpecializeExpr.NumUnresolvedParams)};
37253725
}
37263726

37273727
SourceLoc getLoc() const { return LAngleLoc; }
@@ -3991,11 +3991,11 @@ class SequenceExpr final : public Expr,
39913991
unsigned getNumElements() const { return Bits.SequenceExpr.NumElements; }
39923992

39933993
MutableArrayRef<Expr*> getElements() {
3994-
return {getTrailingObjects<Expr*>(), Bits.SequenceExpr.NumElements};
3994+
return {getTrailingObjects<Expr*>(), static_cast<size_t>(Bits.SequenceExpr.NumElements)};
39953995
}
39963996

39973997
ArrayRef<Expr*> getElements() const {
3998-
return {getTrailingObjects<Expr*>(), Bits.SequenceExpr.NumElements};
3998+
return {getTrailingObjects<Expr*>(), static_cast<size_t>(Bits.SequenceExpr.NumElements)};
39993999
}
40004000

40014001
Expr *getElement(unsigned i) const {
@@ -4594,7 +4594,7 @@ class CaptureListExpr final : public Expr,
45944594

45954595
ArrayRef<CaptureListEntry> getCaptureList() {
45964596
return {getTrailingObjects<CaptureListEntry>(),
4597-
Bits.CaptureListExpr.NumCaptures};
4597+
static_cast<size_t>(Bits.CaptureListExpr.NumCaptures)};
45984598
}
45994599
AbstractClosureExpr *getClosureBody() { return closureBody; }
46004600
const AbstractClosureExpr *getClosureBody() const { return closureBody; }

include/swift/AST/Stmt.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@ class BraceStmt final : public Stmt,
212212

213213
/// The elements contained within the BraceStmt.
214214
MutableArrayRef<ASTNode> getElements() {
215-
return {getTrailingObjects<ASTNode>(), Bits.BraceStmt.NumElements};
215+
return {getTrailingObjects<ASTNode>(), static_cast<size_t>(Bits.BraceStmt.NumElements)};
216216
}
217217

218218
/// The elements contained within the BraceStmt (const version).
219219
ArrayRef<ASTNode> getElements() const {
220-
return {getTrailingObjects<ASTNode>(), Bits.BraceStmt.NumElements};
220+
return {getTrailingObjects<ASTNode>(), static_cast<size_t>(Bits.BraceStmt.NumElements)};
221221
}
222222

223223
ASTNode findAsyncNode();
@@ -330,10 +330,10 @@ class YieldStmt final
330330
SourceLoc getEndLoc() const;
331331

332332
ArrayRef<Expr*> getYields() const {
333-
return {getTrailingObjects<Expr*>(), Bits.YieldStmt.NumYields};
333+
return {getTrailingObjects<Expr*>(), static_cast<size_t>(Bits.YieldStmt.NumYields)};
334334
}
335335
MutableArrayRef<Expr*> getMutableYields() {
336-
return {getTrailingObjects<Expr*>(), Bits.YieldStmt.NumYields};
336+
return {getTrailingObjects<Expr*>(), static_cast<size_t>(Bits.YieldStmt.NumYields)};
337337
}
338338

339339
static bool classof(const Stmt *S) { return S->getKind() == StmtKind::Yield; }
@@ -1259,11 +1259,11 @@ class CaseStmt final
12591259
}
12601260

12611261
ArrayRef<CaseLabelItem> getCaseLabelItems() const {
1262-
return {getTrailingObjects<CaseLabelItem>(), Bits.CaseStmt.NumPatterns};
1262+
return {getTrailingObjects<CaseLabelItem>(), static_cast<size_t>(Bits.CaseStmt.NumPatterns)};
12631263
}
12641264

12651265
MutableArrayRef<CaseLabelItem> getMutableCaseLabelItems() {
1266-
return {getTrailingObjects<CaseLabelItem>(), Bits.CaseStmt.NumPatterns};
1266+
return {getTrailingObjects<CaseLabelItem>(), static_cast<size_t>(Bits.CaseStmt.NumPatterns)};
12671267
}
12681268

12691269
unsigned getNumCaseLabelItems() const { return Bits.CaseStmt.NumPatterns; }
@@ -1448,7 +1448,7 @@ class SwitchStmt final : public LabeledStmt,
14481448
void setSubjectExpr(Expr *e) { SubjectExpr = e; }
14491449

14501450
ArrayRef<ASTNode> getRawCases() const {
1451-
return {getTrailingObjects<ASTNode>(), Bits.SwitchStmt.CaseCount};
1451+
return {getTrailingObjects<ASTNode>(), static_cast<size_t>(Bits.SwitchStmt.CaseCount)};
14521452
}
14531453

14541454
private:
@@ -1541,10 +1541,10 @@ class DoCatchStmt final
15411541
void setBody(Stmt *s) { Body = s; }
15421542

15431543
ArrayRef<CaseStmt *> getCatches() const {
1544-
return {getTrailingObjects<CaseStmt *>(), Bits.DoCatchStmt.NumCatches};
1544+
return {getTrailingObjects<CaseStmt *>(), static_cast<size_t>(Bits.DoCatchStmt.NumCatches)};
15451545
}
15461546
MutableArrayRef<CaseStmt *> getMutableCatches() {
1547-
return {getTrailingObjects<CaseStmt *>(), Bits.DoCatchStmt.NumCatches};
1547+
return {getTrailingObjects<CaseStmt *>(), static_cast<size_t>(Bits.DoCatchStmt.NumCatches)};
15481548
}
15491549

15501550
/// Retrieve the complete set of branches for this do-catch statement.

include/swift/AST/TypeRepr.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ class TupleTypeRepr final : public TypeRepr,
917917

918918
ArrayRef<TupleTypeReprElement> getElements() const {
919919
return { getTrailingObjects<TupleTypeReprElement>(),
920-
Bits.TupleTypeRepr.NumElements };
920+
static_cast<size_t>(Bits.TupleTypeRepr.NumElements) };
921921
}
922922

923923
void getElementTypes(SmallVectorImpl<TypeRepr *> &Types) const {
@@ -1003,7 +1003,7 @@ class CompositionTypeRepr final : public TypeRepr,
10031003

10041004
public:
10051005
ArrayRef<TypeRepr *> getTypes() const {
1006-
return {getTrailingObjects<TypeRepr*>(), Bits.CompositionTypeRepr.NumTypes};
1006+
return {getTrailingObjects<TypeRepr*>(), static_cast<size_t>(Bits.CompositionTypeRepr.NumTypes)};
10071007
}
10081008
SourceLoc getSourceLoc() const { return FirstTypeLoc; }
10091009
SourceRange getCompositionRange() const { return CompositionRange; }
@@ -1494,7 +1494,7 @@ class SILBoxTypeRepr final : public TypeRepr,
14941494

14951495
ArrayRef<Field> getFields() const {
14961496
return {getTrailingObjects<Field>(),
1497-
Bits.SILBoxTypeRepr.NumFields};
1497+
static_cast<size_t>(Bits.SILBoxTypeRepr.NumFields)};
14981498
}
14991499
ArrayRef<TypeRepr *> getGenericArguments() const {
15001500
return {getTrailingObjects<TypeRepr*>(),

include/swift/AST/Types.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2824,7 +2824,7 @@ class BoundGenericType : public NominalOrBoundGenericNominalType,
28242824

28252825
/// Retrieve the set of generic arguments provided at this level.
28262826
ArrayRef<Type> getGenericArgs() const {
2827-
return {getTrailingObjectsPointer(), Bits.BoundGenericType.GenericArgCount};
2827+
return {getTrailingObjectsPointer(), static_cast<size_t>(Bits.BoundGenericType.GenericArgCount)};
28282828
}
28292829

28302830
SmallVector<Type, 2> getExpandedGenericArgs();
@@ -6365,7 +6365,7 @@ class ProtocolCompositionType final : public TypeBase,
63656365
/// a protocol composition type; you also have to look at
63666366
/// hasExplicitAnyObject().
63676367
ArrayRef<Type> getMembers() const {
6368-
return {getTrailingObjects<Type>(), Bits.ProtocolCompositionType.Count};
6368+
return {getTrailingObjects<Type>(), static_cast<size_t>(Bits.ProtocolCompositionType.Count)};
63696369
}
63706370

63716371
InvertibleProtocolSet getInverses() const { return Inverses; }
@@ -6463,7 +6463,7 @@ class ParameterizedProtocolType final : public TypeBase,
64636463

64646464
ArrayRef<Type> getArgs() const {
64656465
return {getTrailingObjects<Type>(),
6466-
Bits.ParameterizedProtocolType.ArgCount};
6466+
static_cast<size_t>(Bits.ParameterizedProtocolType.ArgCount)};
64676467
}
64686468

64696469
bool requiresClass() const {
@@ -7513,7 +7513,7 @@ class ErrorUnionType final
75137513
static Type get(const ASTContext &ctx, ArrayRef<Type> terms);
75147514

75157515
ArrayRef<Type> getTerms() const {
7516-
return { getTrailingObjects<Type>(), Bits.ErrorUnionType.NumTerms };
7516+
return { getTrailingObjects<Type>(), static_cast<size_t>(Bits.ErrorUnionType.NumTerms) };
75177517
};
75187518

75197519
// Support for FoldingSet.

lib/AST/Stmt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ CaseStmt::CaseStmt(CaseParentKind parentKind, SourceLoc itemIntroducerLoc,
771771
}
772772

773773
MutableArrayRef<CaseLabelItem> items{getTrailingObjects<CaseLabelItem>(),
774-
Bits.CaseStmt.NumPatterns};
774+
static_cast<size_t>(Bits.CaseStmt.NumPatterns)};
775775

776776
// At the beginning mark all of our var decls as being owned by this
777777
// statement. In the typechecker we wireup the case stmt var decl list since

0 commit comments

Comments
 (0)