@@ -1600,7 +1600,8 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
1600
1600
} else if (Args.hasArg (options::OPT_emit_objc_header,
1601
1601
options::OPT_emit_objc_header_path,
1602
1602
options::OPT_emit_module_interface,
1603
- options::OPT_emit_module_interface_path) &&
1603
+ options::OPT_emit_module_interface_path,
1604
+ options::OPT_emit_private_module_interface_path) &&
1604
1605
OI.CompilerMode != OutputInfo::Mode::SingleCompile) {
1605
1606
// An option has been passed which requires whole-module knowledge, but we
1606
1607
// don't have that. Generate a module, but treat it as an intermediate
@@ -1942,6 +1943,7 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
1942
1943
case file_types::TY_ModuleTrace:
1943
1944
case file_types::TY_OptRecord:
1944
1945
case file_types::TY_SwiftModuleInterfaceFile:
1946
+ case file_types::TY_PrivateSwiftModuleInterfaceFile:
1945
1947
case file_types::TY_SwiftCrossImportDir:
1946
1948
case file_types::TY_SwiftOverlayFile:
1947
1949
// We could in theory handle assembly or LLVM input, but let's not.
@@ -2734,7 +2736,12 @@ Job *Driver::buildJobsForAction(Compilation &C, const JobAction *JA,
2734
2736
2735
2737
if (C.getArgs ().hasArg (options::OPT_emit_module_interface,
2736
2738
options::OPT_emit_module_interface_path))
2737
- chooseModuleInterfacePath (C, JA, workingDirectory, Buf, Output.get ());
2739
+ chooseModuleInterfacePath (C, JA, workingDirectory, Buf,
2740
+ file_types::TY_SwiftModuleInterfaceFile, Output.get ());
2741
+
2742
+ if (C.getArgs ().hasArg (options::OPT_emit_private_module_interface_path))
2743
+ chooseModuleInterfacePath (C, JA, workingDirectory, Buf,
2744
+ file_types::TY_PrivateSwiftModuleInterfaceFile, Output.get ());
2738
2745
2739
2746
if (C.getArgs ().hasArg (options::OPT_update_code) && isa<CompileJobAction>(JA))
2740
2747
chooseRemappingOutputPath (C, OutputMap, Output.get ());
@@ -3065,9 +3072,10 @@ void Driver::chooseRemappingOutputPath(Compilation &C,
3065
3072
}
3066
3073
3067
3074
void Driver::chooseModuleInterfacePath (Compilation &C, const JobAction *JA,
3068
- StringRef workingDirectory,
3069
- llvm::SmallString<128 > &buffer,
3070
- CommandOutput *output) const {
3075
+ StringRef workingDirectory,
3076
+ llvm::SmallString<128 > &buffer,
3077
+ file_types::ID fileType,
3078
+ CommandOutput *output) const {
3071
3079
switch (C.getOutputInfo ().CompilerMode ) {
3072
3080
case OutputInfo::Mode::StandardCompile:
3073
3081
case OutputInfo::Mode::BatchModeCompile:
@@ -3083,13 +3091,14 @@ void Driver::chooseModuleInterfacePath(Compilation &C, const JobAction *JA,
3083
3091
llvm_unreachable (" these modes aren't usable with 'swiftc'" );
3084
3092
}
3085
3093
3094
+ auto pathOpt = fileType == file_types::TY_SwiftModuleInterfaceFile?
3095
+ options::OPT_emit_module_interface_path:
3096
+ options::OPT_emit_private_module_interface_path;
3097
+
3086
3098
StringRef outputPath = *getOutputFilenameFromPathArgOrAsTopLevel (
3087
- C.getOutputInfo (), C.getArgs (),
3088
- options::OPT_emit_module_interface_path,
3089
- file_types::TY_SwiftModuleInterfaceFile,
3099
+ C.getOutputInfo (), C.getArgs (), pathOpt, fileType,
3090
3100
/* TreatAsTopLevelOutput*/ true , workingDirectory, buffer);
3091
- output->setAdditionalOutputForType (file_types::TY_SwiftModuleInterfaceFile,
3092
- outputPath);
3101
+ output->setAdditionalOutputForType (fileType, outputPath);
3093
3102
}
3094
3103
3095
3104
void Driver::chooseSerializedDiagnosticsPath (Compilation &C,
0 commit comments