@@ -566,23 +566,23 @@ extension Driver {
566
566
. appending ( components: frontendTargetInfo. target. triple. platformName ( ) ?? " " , " Swift.swiftmodule " )
567
567
let hasToolchainStdlib = try fileSystem. exists ( toolchainStdlibPath)
568
568
569
- let skipMacroOptions = isPlanJobForExplicitModule && isFrontendArgSupported ( . loadResolvedPlugin)
569
+ let skipMacroSearchPath = isPlanJobForExplicitModule && isFrontendArgSupported ( . loadResolvedPlugin)
570
570
// If the resource directory has the standard library, prefer the toolchain's plugins
571
571
// to the platform SDK plugins.
572
572
// For explicit module build, the resolved plugins are provided by scanner.
573
- if hasToolchainStdlib, !skipMacroOptions {
574
- try addPluginPathArguments ( commandLine: & commandLine)
573
+ if hasToolchainStdlib {
574
+ try addPluginPathArguments ( commandLine: & commandLine, skipMacroSearchPath : skipMacroSearchPath )
575
575
}
576
576
577
577
try toolchain. addPlatformSpecificCommonFrontendOptions ( commandLine: & commandLine,
578
578
inputs: & inputs,
579
579
frontendTargetInfo: frontendTargetInfo,
580
580
driver: & self ,
581
- skipMacroOptions: skipMacroOptions )
581
+ skipMacroOptions: skipMacroSearchPath )
582
582
583
583
// Otherwise, prefer the platform's plugins.
584
- if !hasToolchainStdlib, !skipMacroOptions {
585
- try addPluginPathArguments ( commandLine: & commandLine)
584
+ if !hasToolchainStdlib {
585
+ try addPluginPathArguments ( commandLine: & commandLine, skipMacroSearchPath : skipMacroSearchPath )
586
586
}
587
587
588
588
if let passPluginPath = parsedOptions. getLastArgument ( . loadPassPluginEQ) ,
@@ -923,7 +923,7 @@ extension Driver {
923
923
entries [ inputEntry, default: [ : ] ] [ output. type] = output. fileHandle
924
924
}
925
925
926
- mutating func addPluginPathArguments( commandLine: inout [ Job . ArgTemplate ] ) throws {
926
+ mutating func addPluginPathArguments( commandLine: inout [ Job . ArgTemplate ] , skipMacroSearchPath : Bool ) throws {
927
927
guard isFrontendArgSupported ( . pluginPath) else {
928
928
return
929
929
}
@@ -938,6 +938,10 @@ extension Driver {
938
938
#endif
939
939
}
940
940
941
+ guard !skipMacroSearchPath else {
942
+ return
943
+ }
944
+
941
945
// Default paths for compiler plugins found within the toolchain
942
946
// (loaded as shared libraries).
943
947
commandLine. appendFlag ( . pluginPath)
0 commit comments