@@ -767,7 +767,7 @@ public struct Driver {
767
767
emitModuleSeparately: emitModuleSeparately,
768
768
outputFileMap: self . outputFileMap,
769
769
moduleName: moduleOutputInfo. name)
770
- self . swiftPrivateInterfacePath = try Self . computeSupplementaryOutputPath (
770
+ let givenPrivateInterfacePath = try Self . computeSupplementaryOutputPath (
771
771
& parsedOptions, type: . privateSwiftInterface, isOutputOptions: [ ] ,
772
772
outputPath: . emitPrivateModuleInterfacePath,
773
773
compilerOutputType: compilerOutputType,
@@ -776,6 +776,19 @@ public struct Driver {
776
776
outputFileMap: self . outputFileMap,
777
777
moduleName: moduleOutputInfo. name)
778
778
779
+ // Always emitting private swift interfaces if public interfaces are emitted.'
780
+ // With the introduction of features like @_spi_available, we may print public
781
+ // and private interfaces differently even from the same codebase. For this reason,
782
+ // we should always print private interfaces so that we don’t mix the public interfaces
783
+ // with private Clang modules.
784
+ if let swiftInterfacePath = self . swiftInterfacePath,
785
+ givenPrivateInterfacePath == nil {
786
+ self . swiftPrivateInterfacePath = VirtualPath . lookup ( swiftInterfacePath)
787
+ . replacingExtension ( with: . privateSwiftInterface) . intern ( )
788
+ } else {
789
+ self . swiftPrivateInterfacePath = givenPrivateInterfacePath
790
+ }
791
+
779
792
var optimizationRecordFileType = FileType . yamlOptimizationRecord
780
793
if let argument = parsedOptions. getLastArgument ( . saveOptimizationRecordEQ) ? . asSingle {
781
794
switch argument {
0 commit comments