@@ -27,14 +27,18 @@ using namespace swift;
2727using Path = SmallString<128 >;
2828
2929static std::optional<Path> getActualModuleMapPath (
30- StringRef name, SearchPathOptions &Opts, const llvm::Triple &triple ,
31- bool isArchSpecific,
30+ StringRef name, SearchPathOptions &Opts, const LangOptions &LangOpts ,
31+ const llvm::Triple &triple, bool isArchSpecific,
3232 const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &vfs) {
3333 StringRef platform;
3434 if (swift::tripleIsMacCatalystEnvironment (triple))
3535 platform = " macosx" ;
3636 else
3737 platform = swift::getPlatformNameForTriple (triple);
38+
39+ if (LangOpts.hasFeature (Feature::Embedded))
40+ platform = " embedded" ;
41+
3842 StringRef arch = swift::getMajorArchitectureName (triple);
3943
4044 Path result;
@@ -95,16 +99,18 @@ static std::optional<Path> getInjectedModuleMapPath(
9599}
96100
97101static std::optional<Path> getLibStdCxxModuleMapPath (
98- SearchPathOptions &opts, const llvm::Triple &triple,
102+ SearchPathOptions &opts, const LangOptions &langOpts,
103+ const llvm::Triple &triple,
99104 const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &vfs) {
100- return getActualModuleMapPath (" libstdcxx.modulemap" , opts, triple,
105+ return getActualModuleMapPath (" libstdcxx.modulemap" , opts, langOpts, triple,
101106 /* isArchSpecific*/ false , vfs);
102107}
103108
104109std::optional<SmallString<128 >>
105110swift::getCxxShimModuleMapPath (SearchPathOptions &opts,
111+ const LangOptions &langOpts,
106112 const llvm::Triple &triple) {
107- return getActualModuleMapPath (" libcxxshim.modulemap" , opts, triple,
113+ return getActualModuleMapPath (" libcxxshim.modulemap" , opts, langOpts, triple,
108114 /* isArchSpecific*/ false ,
109115 llvm::vfs::getRealFileSystem ());
110116}
@@ -225,7 +231,8 @@ getLibcFileMapping(ASTContext &ctx, StringRef modulemapFileName,
225231
226232 Path actualModuleMapPath;
227233 if (auto path = getActualModuleMapPath (modulemapFileName, ctx.SearchPathOpts ,
228- triple, /* isArchSpecific*/ true , vfs))
234+ ctx.LangOpts , triple,
235+ /* isArchSpecific*/ true , vfs))
229236 actualModuleMapPath = path.value ();
230237 else
231238 // FIXME: Emit a warning of some kind.
@@ -305,7 +312,8 @@ static void getLibStdCxxFileMapping(
305312 }
306313
307314 Path actualModuleMapPath;
308- if (auto path = getLibStdCxxModuleMapPath (ctx.SearchPathOpts , triple, vfs))
315+ if (auto path = getLibStdCxxModuleMapPath (ctx.SearchPathOpts , ctx.LangOpts ,
316+ triple, vfs))
309317 actualModuleMapPath = path.value ();
310318 else
311319 return ;
0 commit comments