Skip to content

Commit 2445862

Browse files
committed
FIx recently introduced MSVC control path warnings
1 parent 5e395bc commit 2445862

File tree

9 files changed

+26
-0
lines changed

9 files changed

+26
-0
lines changed

include/swift/AST/Decl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,6 +2646,8 @@ static inline bool isRawPointerKind(PointerTypeKind PTK) {
26462646
case PTK_AutoreleasingUnsafeMutablePointer:
26472647
return false;
26482648
}
2649+
2650+
llvm_unreachable("Unhandled PointerTypeKind in switch.");
26492651
}
26502652

26512653
/// NominalTypeDecl - a declaration of a nominal type, like a struct.

lib/AST/LayoutConstraint.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ StringRef LayoutConstraintInfo::getName(LayoutConstraintKind Kind) {
5858
case LayoutConstraintKind::TrivialOfExactSize:
5959
return "_Trivial";
6060
}
61+
62+
llvm_unreachable("Unhandled LayoutConstraintKind in switch.");
6163
}
6264

6365
SourceRange LayoutConstraintLoc::getSourceRange() const { return getLoc(); }

lib/Basic/Demangler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,8 @@ NodePointer Demangler::demangleGenericRequirement() {
16571657
return LayoutRequirement;
16581658
}
16591659
}
1660+
1661+
llvm_unreachable("Unhandled TypeKind in switch.");
16601662
}
16611663

16621664
NodePointer Demangler::demangleGenericType() {

lib/SIL/SILOwnershipVerifier.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ OwnershipUseCheckerResult OwnershipCompatibilityUseChecker::visitCallee(
442442
case ParameterConvention::Direct_Guaranteed:
443443
return {compatibleWithOwnership(ValueOwnershipKind::Guaranteed), false};
444444
}
445+
446+
llvm_unreachable("Unhandled ParameterConvention in switch.");
445447
}
446448

447449
OwnershipUseCheckerResult
@@ -468,6 +470,8 @@ OwnershipCompatibilityUseChecker::visitApplyInst(ApplyInst *I) {
468470
case SILArgumentConvention::Direct_Deallocating:
469471
llvm_unreachable("No ownership associated with deallocating");
470472
}
473+
474+
llvm_unreachable("Unhandled SILArgumentConvention in switch.");
471475
}
472476

473477
OwnershipUseCheckerResult
@@ -494,6 +498,8 @@ OwnershipCompatibilityUseChecker::visitTryApplyInst(TryApplyInst *I) {
494498
case SILArgumentConvention::Direct_Deallocating:
495499
llvm_unreachable("No ownership associated with deallocating");
496500
}
501+
502+
llvm_unreachable("Unhandled SILArgumentConvention in switch.");
497503
}
498504

499505
OwnershipUseCheckerResult

lib/SIL/SILType.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,4 +601,6 @@ ValueOwnershipKind SILResultInfo::getOwnershipKind(SILModule &M) const {
601601
return ValueOwnershipKind::Trivial;
602602
return ValueOwnershipKind::Unowned;
603603
}
604+
605+
llvm_unreachable("Unhandled ResultConvention in switch.");
604606
}

lib/SIL/SILValue.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ llvm::raw_ostream &swift::operator<<(llvm::raw_ostream &os,
114114
case ValueOwnershipKind::Any:
115115
return os << "Any";
116116
}
117+
118+
llvm_unreachable("Unhandled ValueOwnershipKind in switch.");
117119
}
118120

119121
Optional<ValueOwnershipKind>
@@ -433,6 +435,8 @@ ValueOwnershipKindVisitor::visitSILFunctionArgument(SILFunctionArgument *Arg) {
433435
case SILArgumentConvention::Direct_Deallocating:
434436
llvm_unreachable("No ownership associated with deallocating");
435437
}
438+
439+
llvm_unreachable("Unhandled SILArgumentConvention in switch.");
436440
}
437441

438442
// This is a forwarding instruction through only one of its arguments.
@@ -486,6 +490,8 @@ ValueOwnershipKindVisitor::visitLoadInst(LoadInst *LI) {
486490
case LoadOwnershipQualifier::Trivial:
487491
return ValueOwnershipKind::Trivial;
488492
}
493+
494+
llvm_unreachable("Unhandled LoadOwnershipQualifier in switch.");
489495
}
490496

491497
ValueOwnershipKind SILValue::getOwnershipKind() const {

lib/Sema/CSApply.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6409,6 +6409,8 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
64096409
case DeclTypeCheckingSemantics::Normal:
64106410
return nullptr;
64116411
}
6412+
6413+
llvm_unreachable("Unhandled DeclTypeCheckingSemantics in switch.");
64126414
};
64136415

64146416
// The function is always an rvalue.

lib/Sema/ConstraintSystem.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,8 @@ resolveOverloadForDeclWithSpecialTypeCheckingSemantics(ConstraintSystem &CS,
13591359
return true;
13601360
}
13611361
}
1362+
1363+
llvm_unreachable("Unhandled DeclTypeCheckingSemantics in switch.");
13621364
}
13631365

13641366
void ConstraintSystem::resolveOverload(ConstraintLocator *locator,

lib/Sema/TypeCheckStmt.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,8 @@ static void diagnoseIgnoredLiteral(TypeChecker &TC, LiteralExpr *LE) {
10381038
#include "swift/AST/ExprNodes.def"
10391039
llvm_unreachable("Not a literal expression");
10401040
}
1041+
1042+
llvm_unreachable("Unhandled ExprKind in switch.");
10411043
};
10421044

10431045
TC.diagnose(LE->getLoc(), diag::expression_unused_literal,

0 commit comments

Comments
 (0)