Skip to content

Commit a09df8b

Browse files
author
David Ungar
committed
Fix for rdar://48526524 - wrong module file output when given by two -o’s
1 parent 9c916fc commit a09df8b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Diff for: lib/Frontend/ArgsToFrontendOutputsConverter.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ SupplementaryOutputPathsComputer::computeOutputPathsForOneInput(
401401
ID emitModuleOption;
402402
std::string moduleExtension;
403403
std::string mainOutputIfUsableForModule;
404-
deriveModulePathParameters(emitModuleOption, moduleExtension,
404+
deriveModulePathParameters(outputFile, emitModuleOption, moduleExtension,
405405
mainOutputIfUsableForModule);
406406

407407
auto moduleOutputPath = determineSupplementaryOutputFilename(
@@ -458,7 +458,7 @@ SupplementaryOutputPathsComputer::determineSupplementaryOutputFilename(
458458
};
459459

460460
void SupplementaryOutputPathsComputer::deriveModulePathParameters(
461-
options::ID &emitOption, std::string &extension,
461+
StringRef mainOutputFile, options::ID &emitOption, std::string &extension,
462462
std::string &mainOutputIfUsable) const {
463463

464464
bool isSIB = RequestedAction == FrontendOptions::ActionType::EmitSIB ||
@@ -477,7 +477,7 @@ void SupplementaryOutputPathsComputer::deriveModulePathParameters(
477477
isSIB ? file_types::TY_SIB : file_types::TY_SwiftModuleFile);
478478

479479
mainOutputIfUsable =
480-
canUseMainOutputForModule && !OutputFiles.empty() ? OutputFiles[0] : "";
480+
canUseMainOutputForModule && !OutputFiles.empty() ? mainOutputFile : "";
481481
}
482482

483483
static SupplementaryOutputPaths

Diff for: lib/Frontend/ArgsToFrontendOutputsConverter.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ class SupplementaryOutputPathsComputer {
167167
file_types::ID type, StringRef mainOutputIfUsable,
168168
StringRef defaultSupplementaryOutputPathExcludingExtension) const;
169169

170-
void deriveModulePathParameters(options::ID &emitOption,
170+
void deriveModulePathParameters(StringRef mainOutputFile,
171+
options::ID &emitOption,
171172
std::string &extension,
172173
std::string &mainOutputIfUsable) const;
173174
};

0 commit comments

Comments
 (0)