diff --git a/include/swift/Serialization/ModuleFile.h b/include/swift/Serialization/ModuleFile.h index 93e812fda279a..0af74e92e2d17 100644 --- a/include/swift/Serialization/ModuleFile.h +++ b/include/swift/Serialization/ModuleFile.h @@ -142,7 +142,7 @@ class ModuleFile : public LazyMemberLoader { template class Serialized { private: - using RawBitOffset = decltype(DeclTypeCursor.GetCurrentBitNo()); + using RawBitOffset = uint64_t; using ImplTy = PointerUnion; ImplTy Value; @@ -310,7 +310,7 @@ class ModuleFile : public LazyMemberLoader { std::unique_ptr GroupNamesMap; std::unique_ptr DeclCommentTable; - struct { + struct ModuleBits { /// The decl ID of the main class in this module file, if it has one. unsigned EntryPointDeclID : 31; @@ -336,7 +336,7 @@ class ModuleFile : public LazyMemberLoader { // Explicitly pad out to the next word boundary. unsigned : 0; } Bits = {}; - static_assert(sizeof(Bits) <= 8, "The bit set should be small"); + static_assert(sizeof(ModuleBits) <= 8, "The bit set should be small"); void setStatus(Status status) { Bits.Status = static_cast(status); diff --git a/lib/Serialization/Deserialization.cpp b/lib/Serialization/Deserialization.cpp index fba62f5bd36c2..d392ab189cb1a 100644 --- a/lib/Serialization/Deserialization.cpp +++ b/lib/Serialization/Deserialization.cpp @@ -57,6 +57,8 @@ namespace { #define RECORD(Id) case decls_block::Id: return #Id; #include "swift/Serialization/DeclTypeRecordNodes.def" } + + llvm_unreachable("Unhandled RecordKind in switch."); } virtual void print(raw_ostream &os) const override { @@ -4319,4 +4321,6 @@ Optional ModuleFile::maybeReadForeignErrorConvention() { owned, replaced, canErrorParameterType); } + + llvm_unreachable("Unhandled ForeignErrorConvention in switch."); } diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index 5ac95e28b3330..5960fab7ae583 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -204,6 +204,8 @@ static const Decl *getDeclForContext(const DeclContext *DC) { case DeclContextKind::SubscriptDecl: return cast(DC); } + + llvm_unreachable("Unhandled DeclContextKind in switch."); } namespace { @@ -783,6 +785,8 @@ static uint8_t getRawStableDefaultArgumentKind(swift::DefaultArgumentKind kind) CASE(EmptyDictionary) #undef CASE } + + llvm_unreachable("Unhandled DefaultArgumentKind in switch."); } static uint8_t getRawStableMetatypeRepresentation(AnyMetatypeType *metatype) { @@ -934,6 +938,8 @@ static uint8_t getRawStableRequirementKind(RequirementKind kind) { CASE(SameType) } #undef CASE + + llvm_unreachable("Unhandled RequirementKind in switch."); } void Serializer::writeGenericRequirements(ArrayRef requirements, @@ -1283,6 +1289,8 @@ static uint8_t getRawStableOptionalTypeKind(swift::OptionalTypeKind kind) { return static_cast( serialization::OptionalTypeKind::ImplicitlyUnwrappedOptional); } + + llvm_unreachable("Unhandled OptionalTypeKind in switch."); } static bool shouldSerializeMember(Decl *D) { @@ -1320,6 +1328,8 @@ static bool shouldSerializeMember(Decl *D) { case DeclKind::Func: return true; } + + llvm_unreachable("Unhandled DeclKind in switch."); } void Serializer::writeMembers(DeclRange members, bool isClass) { @@ -1386,6 +1396,8 @@ static serialization::AccessorKind getStableAccessorKind(swift::AccessorKind K){ CASE(MutableAddressor) #undef CASE } + + llvm_unreachable("Unhandled AccessorKind in switch."); } static serialization::CtorInitializerKind @@ -1399,6 +1411,8 @@ getStableCtorInitializerKind(swift::CtorInitializerKind K){ CASE(ConvenienceFactory) #undef CASE } + + llvm_unreachable("Unhandled CtorInitializerKind in switch."); } void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) { @@ -1613,6 +1627,8 @@ static uint8_t getRawStableAssociativity(swift::Associativity assoc) { case swift::Associativity::None: return serialization::Associativity::NonAssociative; } + + llvm_unreachable("Unhandled Associativity in switch."); } static serialization::StaticSpellingKind @@ -1625,6 +1641,8 @@ getStableStaticSpelling(swift::StaticSpellingKind SS) { case swift::StaticSpellingKind::KeywordClass: return serialization::StaticSpellingKind::KeywordClass; } + + llvm_unreachable("Unhandled StaticSpellingKind in switch."); } static uint8_t getRawStableAccessibility(Accessibility access) { @@ -1639,6 +1657,8 @@ static uint8_t getRawStableAccessibility(Accessibility access) { CASE(Open) #undef CASE } + + llvm_unreachable("Unhandled AccessibilityKind in switch."); } #ifndef NDEBUG @@ -2029,6 +2049,8 @@ static ForeignErrorConventionKind getRawStableForeignErrorConventionKind( case ForeignErrorConvention::NonNilError: return ForeignErrorConventionKind::NonNilError; } + + llvm_unreachable("Unhandled ForeignErrorConvention in switch."); } void Serializer::writeForeignErrorConvention(const ForeignErrorConvention &fec){