Skip to content

Commit fe796b4

Browse files
authored
[cxx-interop] Use macosx paths when searching modulemaps for macCatalyst (#76735)
The existing code will use paths for "iphoneos" because the triples for macCatalyst are in the form "<arch>-apple-iosXX.yy-macabi", which the code interprets as an iPhone triple. This seems to work in Xcode because the "iphoneos" folder is always there. When building in open source, this seems to work because it is also normal to have the iPhone SDK configured. This is not the case if you want to build the macOS SDK in isolation. The code changes detect the macCatalyst environment from the triple and use the "macosx" paths instead, otherwise it follows the same code path as before. This matches many places in the CMakeLists.txt files in which macCatalyst support pieces are only enabled when the SDK is macOS. The modified function is also used for the libc modulemap of non-Darwin platforms, but for those triples, the macCatalyst environment should not be detected, so the libc modulemap should not be affected by this change. This is a followup to #76260 and #74994.
1 parent b257874 commit fe796b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/ClangImporter/ClangIncludePaths.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ static std::optional<Path> getActualModuleMapPath(
3030
StringRef name, SearchPathOptions &Opts, const llvm::Triple &triple,
3131
bool isArchSpecific,
3232
const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &vfs) {
33-
StringRef platform = swift::getPlatformNameForTriple(triple);
33+
StringRef platform;
34+
if (swift::tripleIsMacCatalystEnvironment(triple))
35+
platform = "macosx";
36+
else
37+
platform = swift::getPlatformNameForTriple(triple);
3438
StringRef arch = swift::getMajorArchitectureName(triple);
3539

3640
Path result;

0 commit comments

Comments
 (0)