Skip to content

Commit 3a3380f

Browse files
authored
Merge pull request #73814 from al45tair/eng/PR-128219177
[ClangImporter] `-Xclang -fbuiltin-headers-in-system-modules` is being passed when it shouldn't
2 parents b67c4bf + a1f406f commit 3a3380f

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/ClangImporter/ClangIncludePaths.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
186181
static SmallVector<std::pair<std::string, std::string>, 2>
187182
getLibcFileMapping(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

Comments
 (0)