Skip to content

Commit 95af3aa

Browse files
committed
Fix errors and warnings building swift/SILGen on Windows using MSVC
1 parent 6805ecc commit 95af3aa

File tree

9 files changed

+29
-2
lines changed

9 files changed

+29
-2
lines changed

lib/SILGen/ArgumentSource.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ bool ArgumentSource::requiresCalleeToEvaluate() {
5757
case Kind::Expr:
5858
return isa<TupleShuffleExpr>(asKnownExpr());
5959
}
60+
61+
llvm_unreachable("Unhandled Kind in switch.");
6062
}
6163

6264
RValue ArgumentSource::getAsRValue(SILGenFunction &gen, SGFContext C) && {

lib/SILGen/RValue.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ class ImplodeLoadableTupleValue
140140
case ImplodeKind::Copy:
141141
return v.copyUnmanaged(gen, l).forward(gen);
142142
}
143+
144+
llvm_unreachable("Unhandled ImplodeKind in switch.");
143145
}
144146

145147
ImplodeLoadableTupleValue(ArrayRef<ManagedValue> values,

lib/SILGen/SILGenApply.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ class Callee {
427427
case Kind::DynamicMethod:
428428
return Constant.uncurryLevel;
429429
}
430+
431+
llvm_unreachable("Unhandled Kind in switch.");
430432
}
431433

432434
EnumElementDecl *getEnumElementDecl() {
@@ -1487,7 +1489,7 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
14871489

14881490
Callee getCallee() {
14891491
assert(ApplyCallee && "did not find callee?!");
1490-
return *std::move(ApplyCallee);
1492+
return std::move(*ApplyCallee);
14911493
}
14921494

14931495
/// Ignore parentheses and implicit conversions.
@@ -3633,7 +3635,10 @@ void ArgEmitter::emitShuffle(Expr *inner,
36333635
// fill out varargsAddrs if necessary.
36343636
for (auto &extent : innerExtents) {
36353637
assert(extent.Used && "didn't use all the inner tuple elements!");
3636-
innerParams.append(extent.Params.begin(), extent.Params.end());
3638+
3639+
for (auto param : extent.Params) {
3640+
innerParams.push_back(param);
3641+
}
36373642

36383643
// Fill in the special destinations array.
36393644
if (innerSpecialDests) {

lib/SILGen/SILGenConvert.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,8 @@ ManagedValue SILGenFunction::emitExistentialErasure(
667667
return manageBufferForExprResult(existential, existentialTL, C);
668668
}
669669
}
670+
671+
llvm_unreachable("Unhandled ExistentialRepresentation in switch.");
670672
}
671673

672674
ManagedValue SILGenFunction::emitClassMetatypeToObject(SILLocation loc,

lib/SILGen/SILGenExpr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,6 +2091,8 @@ visitMagicIdentifierLiteralExpr(MagicIdentifierLiteralExpr *E, SGFContext C) {
20912091
return RValue(SGF, E, ManagedValue::forUnmanaged(UnsafeRawPtrStruct));
20922092
}
20932093
}
2094+
2095+
llvm_unreachable("Unhandled MagicIdentifierLiteralExpr in switch.");
20942096
}
20952097

20962098
RValue RValueEmitter::visitCollectionExpr(CollectionExpr *E, SGFContext C) {

lib/SILGen/SILGenFunction.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ DeclName SILGenModule::getMagicFunctionName(SILDeclRef ref) {
128128
return getMagicFunctionName(cast<EnumElementDecl>(ref.getDecl())
129129
->getDeclContext());
130130
}
131+
132+
llvm_unreachable("Unhandled SILDeclRefKind in switch.");
131133
}
132134

133135
SILValue SILGenFunction::emitGlobalFunctionRef(SILLocation loc,

lib/SILGen/SILGenPattern.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ static bool isWildcardPattern(const Pattern *p) {
222222
case PatternKind::Var:
223223
return isWildcardPattern(p->getSemanticsProvidingPattern());
224224
}
225+
226+
llvm_unreachable("Unhandled PatternKind in switch.");
225227
}
226228

227229
/// Check to see if the given pattern is a specializing pattern,
@@ -284,6 +286,8 @@ static Pattern *getSimilarSpecializingPattern(Pattern *p, Pattern *first) {
284286
case PatternKind::Typed:
285287
llvm_unreachable("not semantic");
286288
}
289+
290+
llvm_unreachable("Unhandled PatternKind in switch.");
287291
}
288292

289293
namespace {

lib/SILGen/SILGenPoly.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,6 +2788,8 @@ getWitnessFunctionType(SILGenModule &SGM,
27882788
case WitnessDispatchKind::Class:
27892789
return SGM.Types.getConstantOverrideType(witness);
27902790
}
2791+
2792+
llvm_unreachable("Unhandled WitnessDispatchKind in switch.");
27912793
}
27922794

27932795
static SILValue
@@ -2808,6 +2810,8 @@ getWitnessFunctionRef(SILGenFunction &gen,
28082810
SILValue selfPtr = witnessParams.back().getValue();
28092811
return gen.B.createClassMethod(loc, selfPtr, witness);
28102812
}
2813+
2814+
llvm_unreachable("Unhandled WitnessDispatchKind in switch.");
28112815
}
28122816

28132817
static CanType dropLastElement(CanType type) {

lib/SILGen/SILGenProfiling.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ class CounterExpr {
226226
case Kind::Ref:
227227
return LHS->expand(Builder, Counters);
228228
}
229+
230+
llvm_unreachable("Unhandled Kind in switch.");
229231
}
230232
};
231233

@@ -694,6 +696,8 @@ getEquivalentPGOLinkage(FormalLinkage Linkage) {
694696
case FormalLinkage::Private:
695697
return llvm::GlobalValue::PrivateLinkage;
696698
}
699+
700+
llvm_unreachable("Unhandled FormalLinkage in switch.");
697701
}
698702

699703
void SILGenProfiling::assignRegionCounters(Decl *Root) {

0 commit comments

Comments
 (0)