diff --git a/lib/ClangImporter/ClangAdapter.cpp b/lib/ClangImporter/ClangAdapter.cpp index 2a0bd7a19889b..9fa086d3a2e52 100644 --- a/lib/ClangImporter/ClangAdapter.cpp +++ b/lib/ClangImporter/ClangAdapter.cpp @@ -563,6 +563,8 @@ OptionalTypeKind importer::translateNullability(clang::NullabilityKind kind) { case clang::NullabilityKind::Unspecified: return OptionalTypeKind::OTK_ImplicitlyUnwrappedOptional; } + + llvm_unreachable("Invalid NullabilityKind."); } bool importer::hasDesignatedInitializers( diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index bf32910cf9f55..898fdca6bb5d6 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -2739,6 +2739,8 @@ namespace { return nullptr; } } + + llvm_unreachable("Invalid EnumKind."); } diff --git a/lib/ClangImporter/ImportEnumInfo.cpp b/lib/ClangImporter/ImportEnumInfo.cpp index 685681cca7024..453583233eab2 100644 --- a/lib/ClangImporter/ImportEnumInfo.cpp +++ b/lib/ClangImporter/ImportEnumInfo.cpp @@ -222,6 +222,8 @@ void EnumInfo::determineConstantNamePrefix(ASTContext &ctx, case clang::AR_Unavailable: return false; } + + llvm_unreachable("Invalid AvailabilityAttr."); }; // Move to the first non-deprecated enumerator, or non-swift_name'd diff --git a/lib/ClangImporter/ImportName.cpp b/lib/ClangImporter/ImportName.cpp index e31d7e04f152b..7288d8cae5f68 100644 --- a/lib/ClangImporter/ImportName.cpp +++ b/lib/ClangImporter/ImportName.cpp @@ -1094,7 +1094,7 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D, // Objective-C categories and extensions don't have names, despite // being "named" declarations. if (isa(D)) - return {}; + return ImportedName(); // Dig out the definition, if there is one. if (auto def = getDefinitionForClangTypeDecl(D)) { @@ -1106,7 +1106,7 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D, auto dc = const_cast(D->getDeclContext()); auto effectiveCtx = determineEffectiveContext(D, dc, options); if (!effectiveCtx) - return {}; + return ImportedName(); result.EffectiveContext = effectiveCtx; // FIXME: ugly to check here, instead perform unified check up front in @@ -1192,7 +1192,7 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D, if (!shouldImportAsInitializer(method, initPrefixLength, result.InitKind)) { // We cannot import this as an initializer anyway. - return {}; + return ImportedName(); } // If this swift_name attribute maps a factory method to an diff --git a/lib/ClangImporter/ImportName.h b/lib/ClangImporter/ImportName.h index 0323ac1ec61c4..ab3958358e77d 100644 --- a/lib/ClangImporter/ImportName.h +++ b/lib/ClangImporter/ImportName.h @@ -130,6 +130,8 @@ struct ImportedName { case ImportedAccessorKind::SubscriptSetter: return true; } + + llvm_unreachable("Invalid ImportedAccessorKind."); } }; diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 4bdd187c595bf..95537e091fb42 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -140,6 +140,8 @@ namespace { case ImportHint::SwiftNewtypeFromCFPointer: return true; } + + llvm_unreachable("Invalid ImportHint."); } struct ImportResult { @@ -173,6 +175,8 @@ namespace { return OptionalType::get(payloadType); return ImplicitlyUnwrappedOptionalType::get(payloadType); } + + llvm_unreachable("Invalid OptionalTypeKind."); } class SwiftTypeConverter : @@ -296,6 +300,8 @@ namespace { case clang::BuiltinType::OMPArraySection: return Type(); } + + llvm_unreachable("Invalid BuiltinType."); } ImportResult VisitComplexType(const clang::ComplexType *type) { @@ -783,6 +789,8 @@ namespace { return getAdjustedTypeDeclReferenceType(decl); } } + + llvm_unreachable("Invalid EnumKind."); } ImportResult VisitObjCObjectType(const clang::ObjCObjectType *type) { @@ -1051,6 +1059,8 @@ static bool canBridgeTypes(ImportTypeKind importKind) { case ImportTypeKind::BridgedValue: return true; } + + llvm_unreachable("Invalid ImportTypeKind."); } /// True if the type has known CoreFoundation reference counting semantics. @@ -1075,6 +1085,8 @@ static bool isCFAudited(ImportTypeKind importKind) { case ImportTypeKind::PropertyWithReferenceSemantics: return true; } + + llvm_unreachable("Invalid ImportTypeKind."); } /// Turn T into Unmanaged. @@ -1744,6 +1756,8 @@ adjustResultTypeForThrowingFunction(const ImportedErrorInfo &errorInfo, case ForeignErrorConvention::NonNilError: return resultTy; } + + llvm_unreachable("Invalid ForeignErrorConvention."); } /// Produce the foreign error convention from the imported error info, diff --git a/lib/ClangImporter/SwiftLookupTable.cpp b/lib/ClangImporter/SwiftLookupTable.cpp index 86eacd6a19ce9..3d2b98bd93817 100644 --- a/lib/ClangImporter/SwiftLookupTable.cpp +++ b/lib/ClangImporter/SwiftLookupTable.cpp @@ -214,6 +214,8 @@ bool SwiftLookupTable::contextRequiresName(ContextKind kind) { case ContextKind::TranslationUnit: return false; } + + llvm_unreachable("Invalid ContextKind."); } /// Try to translate the given Clang declaration into a context. @@ -293,6 +295,8 @@ SwiftLookupTable::translateContext(EffectiveClangContext context) { return None; } + + llvm_unreachable("Invalid EffectiveClangContext."); } /// Lookup an unresolved context name and resolve it to a Clang