From 04f4be682d05e873b7d55525ad53bcc33969cbbb Mon Sep 17 00:00:00 2001 From: Steven Wu Date: Mon, 15 Dec 2025 11:56:41 -0800 Subject: [PATCH] [ModuleLoader] Remove `llvm_unreachable` in findModuleFilesInDirectory() In the explicit module loaders, findModuleFilesInDirectory() is not a supported operation and swift compiler is not expected to call this function, thus it uses `llvm_unreachable`. However, LLDB and other clients can configure module loader that allow fallbacks from explicit module loaders, thus we should function calls to actually return and not terminating the process. Just let the function return `not_supported`. rdar://166557713 --- lib/Frontend/ModuleInterfaceLoader.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/Frontend/ModuleInterfaceLoader.cpp b/lib/Frontend/ModuleInterfaceLoader.cpp index 6b300e012cca7..35a3db79c2c25 100644 --- a/lib/Frontend/ModuleInterfaceLoader.cpp +++ b/lib/Frontend/ModuleInterfaceLoader.cpp @@ -2380,7 +2380,6 @@ std::error_code ExplicitSwiftModuleLoader::findModuleFilesInDirectory( std::unique_ptr *ModuleSourceInfoBuffer, bool IsCanImportLookup, bool IsFramework, bool IsTestableDependencyLookup) { - llvm_unreachable("Not supported in the Explicit Swift Module Loader."); return std::make_error_code(std::errc::not_supported); } @@ -2754,7 +2753,6 @@ std::error_code ExplicitCASModuleLoader::findModuleFilesInDirectory( std::unique_ptr *ModuleSourceInfoBuffer, bool IsCanImportLookup, bool IsFramework, bool IsTestableDependencyLookup) { - llvm_unreachable("Not supported in the Explicit Swift Module Loader."); return std::make_error_code(std::errc::not_supported); }