@@ -894,6 +894,7 @@ getClangInvocationFileMapping(ASTContext &ctx) {
894
894
// If an SDK path was explicitly passed to Swift, make sure to pass it to
895
895
// Clang driver as well. It affects the resulting include paths.
896
896
auto sdkPath = ctx.SearchPathOpts .getSDKPath ();
897
+ llvm::errs () << " DIR: " << sdkPath << " \n " ;
897
898
if (!sdkPath.empty ()) {
898
899
unsigned argIndex = clangDriverArgs.MakeIndex (" --sysroot" , sdkPath);
899
900
clangDriverArgs.append (new llvm::opt::Arg (
@@ -902,6 +903,9 @@ getClangInvocationFileMapping(ASTContext &ctx) {
902
903
}
903
904
auto cxxStdlibDirs =
904
905
clangDriver.getLibStdCxxIncludePaths (clangDriverArgs, triple);
906
+ for (auto it : cxxStdlibDirs) {
907
+ llvm::errs () << " DIR: " << it << " \n " ;
908
+ }
905
909
if (cxxStdlibDirs.empty ()) {
906
910
ctx.Diags .diagnose (SourceLoc (), diag::libstdcxx_not_found, triple.str ());
907
911
return {};
@@ -920,6 +924,8 @@ getClangInvocationFileMapping(ASTContext &ctx) {
920
924
actualModuleMapPath = path.getValue ();
921
925
else
922
926
return {};
927
+ llvm::sys::path::remove_dots (actualModuleMapPath, /* remove_dot_dot=*/ true );
928
+ llvm::errs () << " actualModuleMapPath: " << actualModuleMapPath << " \n " ;
923
929
924
930
// Only inject the module map if it actually exists. It may not, for example
925
931
// if `swiftc -target x86_64-unknown-linux-gnu -emit-ir` is invoked using
@@ -928,6 +934,7 @@ getClangInvocationFileMapping(ASTContext &ctx) {
928
934
// FIXME: emit a warning of some kind.
929
935
return {};
930
936
937
+ llvm::errs () << " exists: " << actualModuleMapPath << " \n " ;
931
938
// TODO: remove the libstdcxx.h header and reference all libstdc++ headers
932
939
// directly from the modulemap.
933
940
Path actualHeaderPath = actualModuleMapPath;
@@ -950,6 +957,8 @@ getClangInvocationFileMapping(ASTContext &ctx) {
950
957
Path injectedHeaderPath (cxxStdlibDir);
951
958
llvm::sys::path::append (injectedHeaderPath, " libstdcxx.h" );
952
959
960
+ llvm::errs () << " injecting \n " ;
961
+ llvm::errs () << injectedModuleMapPath << " to " << actualModuleMapPath << " \n " ;
953
962
return {
954
963
{std::string (injectedModuleMapPath), std::string (actualModuleMapPath)},
955
964
{std::string (injectedHeaderPath), std::string (actualHeaderPath)},
@@ -1211,7 +1220,7 @@ ClangImporter::create(ASTContext &ctx,
1211
1220
auto fileMapping = getClangInvocationFileMapping (ctx);
1212
1221
// Wrap Swift's FS to allow Clang to override the working directory
1213
1222
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS =
1214
- llvm::vfs::RedirectingFileSystem::create (fileMapping, true ,
1223
+ llvm::vfs::RedirectingFileSystem::create (fileMapping, false ,
1215
1224
*ctx.SourceMgr .getFileSystem ());
1216
1225
1217
1226
// Create a new Clang compiler invocation.
0 commit comments