@@ -178,18 +178,11 @@ createClangArgs(const ASTContext &ctx, clang::driver::Driver &clangDriver) {
178178 return clangDriverArgs;
179179}
180180
181- static bool shouldInjectLibcModulemap (const llvm::Triple &triple) {
182- return triple.isOSGlibc () || triple.isOSOpenBSD () || triple.isOSFreeBSD () ||
183- triple.isAndroid () || triple.isMusl () || triple.isOSWASI ();
184- }
185-
186181static SmallVector<std::pair<std::string, std::string>, 2 >
187182getLibcFileMapping (ASTContext &ctx, StringRef modulemapFileName,
188183 std::optional<StringRef> maybeHeaderFileName,
189184 const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &vfs) {
190185 const llvm::Triple &triple = ctx.LangOpts .Target ;
191- if (!shouldInjectLibcModulemap (triple))
192- return {};
193186
194187 // Extract the libc path from Clang driver.
195188 auto clangDriver = createClangDriver (ctx, vfs);
@@ -559,7 +552,8 @@ ClangInvocationFileMapping swift::getClangInvocationFileMapping(
559552 } else if (triple.isMusl ()) {
560553 libcFileMapping =
561554 getLibcFileMapping (ctx, " musl.modulemap" , StringRef (" SwiftMusl.h" ), vfs);
562- } else {
555+ } else if (triple.isOSGlibc () || triple.isOSOpenBSD () ||
556+ triple.isOSFreeBSD () || triple.isAndroid ()) {
563557 // Android/BSD/Linux Mappings
564558 libcFileMapping = getLibcFileMapping (ctx, " glibc.modulemap" ,
565559 StringRef (" SwiftGlibc.h" ), vfs);
0 commit comments