@@ -27,14 +27,18 @@ using namespace swift;
27
27
using Path = SmallString<128 >;
28
28
29
29
static 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,
32
32
const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &vfs) {
33
33
StringRef platform;
34
34
if (swift::tripleIsMacCatalystEnvironment (triple))
35
35
platform = " macosx" ;
36
36
else
37
37
platform = swift::getPlatformNameForTriple (triple);
38
+
39
+ if (LangOpts.hasFeature (Feature::Embedded))
40
+ platform = " embedded" ;
41
+
38
42
StringRef arch = swift::getMajorArchitectureName (triple);
39
43
40
44
Path result;
@@ -95,16 +99,18 @@ static std::optional<Path> getInjectedModuleMapPath(
95
99
}
96
100
97
101
static std::optional<Path> getLibStdCxxModuleMapPath (
98
- SearchPathOptions &opts, const llvm::Triple &triple,
102
+ SearchPathOptions &opts, const LangOptions &langOpts,
103
+ const llvm::Triple &triple,
99
104
const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &vfs) {
100
- return getActualModuleMapPath (" libstdcxx.modulemap" , opts, triple,
105
+ return getActualModuleMapPath (" libstdcxx.modulemap" , opts, langOpts, triple,
101
106
/* isArchSpecific*/ false , vfs);
102
107
}
103
108
104
109
std::optional<SmallString<128 >>
105
110
swift::getCxxShimModuleMapPath (SearchPathOptions &opts,
111
+ const LangOptions &langOpts,
106
112
const llvm::Triple &triple) {
107
- return getActualModuleMapPath (" libcxxshim.modulemap" , opts, triple,
113
+ return getActualModuleMapPath (" libcxxshim.modulemap" , opts, langOpts, triple,
108
114
/* isArchSpecific*/ false ,
109
115
llvm::vfs::getRealFileSystem ());
110
116
}
@@ -225,7 +231,8 @@ getLibcFileMapping(ASTContext &ctx, StringRef modulemapFileName,
225
231
226
232
Path actualModuleMapPath;
227
233
if (auto path = getActualModuleMapPath (modulemapFileName, ctx.SearchPathOpts ,
228
- triple, /* isArchSpecific*/ true , vfs))
234
+ ctx.LangOpts , triple,
235
+ /* isArchSpecific*/ true , vfs))
229
236
actualModuleMapPath = path.value ();
230
237
else
231
238
// FIXME: Emit a warning of some kind.
@@ -305,7 +312,8 @@ static void getLibStdCxxFileMapping(
305
312
}
306
313
307
314
Path actualModuleMapPath;
308
- if (auto path = getLibStdCxxModuleMapPath (ctx.SearchPathOpts , triple, vfs))
315
+ if (auto path = getLibStdCxxModuleMapPath (ctx.SearchPathOpts , ctx.LangOpts ,
316
+ triple, vfs))
309
317
actualModuleMapPath = path.value ();
310
318
else
311
319
return ;
0 commit comments