Skip to content

Commit

Permalink
[NFC] Silence Non-Exhaustive Switch Warnings on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
CodaFi committed Oct 14, 2020
1 parent 804459d commit 6125d25
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/swift/AST/Decl.h
Expand Up @@ -3762,6 +3762,7 @@ struct SelfReferencePosition final {
case Contravariant:
return Covariant;
}
llvm_unreachable("unhandled self reference position!");
}

explicit operator bool() const { return kind > None; }
Expand Down
1 change: 1 addition & 0 deletions include/swift/AST/ForeignErrorConvention.h
Expand Up @@ -198,6 +198,7 @@ class ForeignErrorConvention {
case NonNilError:
return false;
}
llvm_unreachable("unhandled foreign error kind!");
}

bool operator==(ForeignErrorConvention other) const {
Expand Down
1 change: 1 addition & 0 deletions include/swift/Demangling/TypeLookupError.h
Expand Up @@ -150,6 +150,7 @@ class TypeLookupError {
delete castContext;
return nullptr;
}
llvm_unreachable("unhandled command!");
};
}

Expand Down
2 changes: 2 additions & 0 deletions include/swift/Sema/ConstraintSystem.h
Expand Up @@ -1907,6 +1907,7 @@ class SolutionApplicationTarget {
case Kind::patternBinding:
return patternBinding;
}
llvm_unreachable("invalid case label type");
}

VarDecl *getAsUninitializedWrappedVar() const {
Expand All @@ -1921,6 +1922,7 @@ class SolutionApplicationTarget {
case Kind::uninitializedWrappedVar:
return uninitializedWrappedVar;
}
llvm_unreachable("invalid case label type");
}

BraceStmt *getFunctionBody() const {
Expand Down
1 change: 1 addition & 0 deletions lib/AST/AutoDiff.cpp
Expand Up @@ -462,6 +462,7 @@ bool swift::operator==(const TangentPropertyInfo::Error &lhs,
case TangentPropertyInfo::Error::Kind::TangentPropertyWrongType:
return lhs.getType()->isEqual(rhs.getType());
}
llvm_unreachable("unhandled tangent property!");
}

void swift::simple_display(llvm::raw_ostream &os, TangentPropertyInfo info) {
Expand Down
1 change: 1 addition & 0 deletions lib/AST/ClangTypeConverter.cpp
Expand Up @@ -207,6 +207,7 @@ const clang::Type *ClangTypeConverter::getFunctionType(
case SILFunctionType::Representation::Closure:
llvm_unreachable("Expected a C-compatible representation.");
}
llvm_unreachable("unhandled representation!");
}

clang::QualType ClangTypeConverter::convertMemberType(NominalTypeDecl *DC,
Expand Down
2 changes: 2 additions & 0 deletions lib/AST/TypeCheckRequests.cpp
Expand Up @@ -1497,6 +1497,7 @@ bool ActorIsolation::requiresSubstitution() const {
case GlobalActor:
return getGlobalActor()->hasTypeParameter();
}
llvm_unreachable("unhandled actor isolation kind!");
}

ActorIsolation ActorIsolation::subst(SubstitutionMap subs) const {
Expand All @@ -1509,6 +1510,7 @@ ActorIsolation ActorIsolation::subst(SubstitutionMap subs) const {
case GlobalActor:
return forGlobalActor(getGlobalActor().subst(subs));
}
llvm_unreachable("unhandled actor isolation kind!");
}

void swift::simple_display(
Expand Down
1 change: 1 addition & 0 deletions lib/Driver/DarwinToolChains.cpp
Expand Up @@ -364,6 +364,7 @@ bool jobMatchesFilter(LinkKind jobKind, BackDeployLibFilter filter) {
case BackDeployLibFilter::all:
return true;
}
llvm_unreachable("unhandled back deploy lib filter!");
}

}
Expand Down
1 change: 1 addition & 0 deletions lib/IDE/APIDigesterData.cpp
Expand Up @@ -56,6 +56,7 @@ StringRef swift::ide::api::getDeclKindStr(const DeclKind Value, bool lower) {
}
#include "swift/AST/DeclNodes.def"
}
llvm_unreachable("Unhandled DeclKind in switch.");
} else {
return getDeclKindStrRaw(Value);
}
Expand Down
1 change: 1 addition & 0 deletions lib/IRGen/MetadataLayout.cpp
Expand Up @@ -414,6 +414,7 @@ ClassMetadataLayout::getMethodInfo(IRGenFunction &IGF, SILDeclRef method) const{
case MethodInfo::Kind::DirectImpl:
return MethodInfo(stored.TheImpl);
}
llvm_unreachable("unhandled method info kind!");
}

Offset ClassMetadataLayout::getFieldOffset(IRGenFunction &IGF,
Expand Down
1 change: 1 addition & 0 deletions lib/IRGen/MetadataRequest.cpp
Expand Up @@ -616,6 +616,7 @@ static MetadataResponse emitNominalPrespecializedGenericMetadataRef(
return MetadataResponse::handle(IGF, request, call);
}
}
llvm_unreachable("unhandled metadata canonicality");
}

static llvm::Value *
Expand Down
1 change: 1 addition & 0 deletions lib/SILOptimizer/Differentiation/PullbackCloner.cpp
Expand Up @@ -336,6 +336,7 @@ class PullbackCloner::Implementation final
case AdjointValueKind::Concrete:
return val.getConcreteValue();
}
llvm_unreachable("unhandled adjoint value kind!");
}

/// Materializes an adjoint value indirectly to a SIL buffer.
Expand Down
2 changes: 2 additions & 0 deletions lib/SILOptimizer/SemanticARC/OwnershipPhiOperand.h
Expand Up @@ -88,6 +88,7 @@ class LLVM_LIBRARY_VISIBILITY OwnershipPhiOperand {
case Kind::Struct:
return false;
}
llvm_unreachable("unhandled operand kind!");
}

bool operator<(const OwnershipPhiOperand &other) const {
Expand All @@ -113,6 +114,7 @@ class LLVM_LIBRARY_VISIBILITY OwnershipPhiOperand {
});
}
}
llvm_unreachable("unhandled operand kind!");
}
};

Expand Down
1 change: 1 addition & 0 deletions lib/SILOptimizer/Transforms/AllocBoxToStack.cpp
Expand Up @@ -984,6 +984,7 @@ specializeApplySite(SILOptFunctionBuilder &FuncBuilder, ApplySite Apply,
GenericSpecializationInformation::create(ApplyInst, Builder));
}
}
llvm_unreachable("unhandled apply inst kind!");
}

static void rewriteApplySites(AllocBoxToStackState &pass) {
Expand Down
3 changes: 3 additions & 0 deletions lib/Sema/TypeCheckConcurrency.cpp
Expand Up @@ -825,6 +825,7 @@ void swift::checkActorIsolation(const Expr *expr, const DeclContext *dc) {
// Okay.
return false;
}
llvm_unreachable("unhandled actor isolation kind!");
}

/// Check a reference to a local or global.
Expand Down Expand Up @@ -868,6 +869,7 @@ void swift::checkActorIsolation(const Expr *expr, const DeclContext *dc) {
case ActorIsolationRestriction::Unsafe:
return diagnoseReferenceToUnsafe(value, loc);
}
llvm_unreachable("unhandled actor isolation kind!");
}

/// Check a reference with the given base expression to the given member.
Expand Down Expand Up @@ -964,6 +966,7 @@ void swift::checkActorIsolation(const Expr *expr, const DeclContext *dc) {
case ActorIsolationRestriction::Unsafe:
return diagnoseReferenceToUnsafe(member, memberLoc);
}
llvm_unreachable("unhandled actor isolation kind!");
}
};

Expand Down
1 change: 1 addition & 0 deletions lib/Sema/TypeCheckRequestFunctions.cpp
Expand Up @@ -262,6 +262,7 @@ static Type inferFunctionBuilderType(ValueDecl *decl) {
case DynamicReplacement:
return dynamicReplacement->getName();
}
llvm_unreachable("unhandled decl name kind!");
}
};

Expand Down

0 comments on commit 6125d25

Please sign in to comment.