[ClangImporter][ModuleWrap] Turn off libc warnings.

`swift-modulewrap` uses the `ClangImporter` to obtain a module loader,
but it doesn't take an SDK argument (nor does anything bother to pass
one), which means that when cross-compiling you get warnings about not
being able to find the C library.

Suppress the warning by telling the `ClangImporter` that we don't care
about the C library here.

rdar://115918181
This commit is contained in:
Alastair Houghton
2024-09-18 13:56:53 +01:00
parent 365b72f606
commit 6e48b1d781
3 changed files with 14 additions and 5 deletions

View File

@@ -196,8 +196,11 @@ int modulewrap_main(ArrayRef<const char *> Args, const char *Argv0,
llvm::makeIntrusiveRefCnt<llvm::vfs::OnDiskOutputBackend>());
registerParseRequestFunctions(ASTCtx.evaluator);
registerTypeCheckerRequestFunctions(ASTCtx.evaluator);
ASTCtx.addModuleLoader(ClangImporter::create(ASTCtx, ""), true);
ASTCtx.addModuleLoader(ClangImporter::create(ASTCtx, "",
nullptr, nullptr,
true),
true);
ModuleDecl *M = ModuleDecl::create(ASTCtx.getIdentifier("swiftmodule"), ASTCtx);
std::unique_ptr<Lowering::TypeConverter> TC(
new Lowering::TypeConverter(*M, ASTCtx.SILOpts.EnableSILOpaqueValues));