@@ -178,18 +178,11 @@ createClangArgs(const ASTContext &ctx, clang::driver::Driver &clangDriver) {
178
178
return clangDriverArgs;
179
179
}
180
180
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
-
186
181
static SmallVector<std::pair<std::string, std::string>, 2 >
187
182
getLibcFileMapping (ASTContext &ctx, StringRef modulemapFileName,
188
183
std::optional<StringRef> maybeHeaderFileName,
189
184
const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &vfs) {
190
185
const llvm::Triple &triple = ctx.LangOpts .Target ;
191
- if (!shouldInjectLibcModulemap (triple))
192
- return {};
193
186
194
187
// Extract the libc path from Clang driver.
195
188
auto clangDriver = createClangDriver (ctx, vfs);
@@ -559,7 +552,8 @@ ClangInvocationFileMapping swift::getClangInvocationFileMapping(
559
552
} else if (triple.isMusl ()) {
560
553
libcFileMapping =
561
554
getLibcFileMapping (ctx, " musl.modulemap" , StringRef (" SwiftMusl.h" ), vfs);
562
- } else {
555
+ } else if (triple.isOSGlibc () || triple.isOSOpenBSD () ||
556
+ triple.isOSFreeBSD () || triple.isAndroid ()) {
563
557
// Android/BSD/Linux Mappings
564
558
libcFileMapping = getLibcFileMapping (ctx, " glibc.modulemap" ,
565
559
StringRef (" SwiftGlibc.h" ), vfs);
0 commit comments