Skip to content

Commit 18cb1c8

Browse files
committed
[Macros on Darwin] Use device platform paths when building for the simulator
To avoid having duplicated macro implementations in both the device and simulator platforms, when building for a simulator platform, pass `-external-plugin-path` that points into the *device* platform. There is no need to have macro implementations in the simulator platforms. Implements rdar://112563655.
1 parent 68c464f commit 18cb1c8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/Driver/DarwinToolChains.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,15 @@ void toolchains::Darwin::addPlatformSpecificPluginFrontendArgs(
660660
llvm::sys::path::remove_filename(platformPath); // specific SDK
661661
llvm::sys::path::remove_filename(platformPath); // SDKs
662662
llvm::sys::path::remove_filename(platformPath); // Developer
663+
664+
StringRef platformName = llvm::sys::path::filename(platformPath);
665+
if (platformName.endswith("Simulator.platform")){
666+
StringRef devicePlatformName =
667+
platformName.drop_back(strlen("Simulator.platform"));
668+
llvm::sys::path::remove_filename(platformPath); // Platform
669+
llvm::sys::path::append(platformPath, devicePlatformName + "OS.platform");
670+
}
671+
663672
llvm::sys::path::append(platformPath, "Developer");
664673
addExternalPluginFrontendArgs(platformPath, inputArgs, arguments);
665674
}

0 commit comments

Comments
 (0)