Skip to content

Commit 6a55161

Browse files
committed
Correct VFS libc modulemap injection condition.
We should only be skipping VFS libc modulemap injection on Darwin and Windows. Unfortunately, we cannot just use the isOSGlibc Triple method because LLVM's sense of Glibc (does the platform _actually use_ glibc) differs from Swift's sense of Glibc (does the platform use libc). There may be other non-libc platforms that we should skip VFS injection on but let's correct the conditional for now and other prs should add those platforms as necessary.
1 parent e5a35f9 commit 6a55161

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/ClangImporter/ClangIncludePaths.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,15 @@ createClangArgs(const ASTContext &ctx, clang::driver::Driver &clangDriver) {
171171
return clangDriverArgs;
172172
}
173173

174+
static bool shouldInjectGlibcModulemap(const llvm::Triple &triple) {
175+
return triple.isOSGlibc() || triple.isOSOpenBSD() || triple.isOSFreeBSD() ||
176+
triple.isAndroid();
177+
}
178+
174179
static SmallVector<std::pair<std::string, std::string>, 2>
175180
getGlibcFileMapping(ASTContext &ctx) {
176181
const llvm::Triple &triple = ctx.LangOpts.Target;
177-
// We currently only need this when building for Linux.
178-
if (!triple.isOSLinux())
182+
if (!shouldInjectGlibcModulemap(triple))
179183
return {};
180184

181185
// Extract the Glibc path from Clang driver.

0 commit comments

Comments
 (0)