Skip to content

Commit ab35896

Browse files
authored
Merge pull request #23120 from davidungar/fix-for-rdar-48526524
2 parents 92cc001 + 46ec774 commit ab35896

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

lib/Frontend/ArgsToFrontendOutputsConverter.cpp

Lines changed: 3 additions & 3 deletions
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

lib/Frontend/ArgsToFrontendOutputsConverter.h

Lines changed: 2 additions & 1 deletion
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
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: touch %t/file-01.swift
3+
// RUN: touch %t/file-02.swift
4+
// RUN: cd %t
5+
// RUN: %target-swift-frontend -emit-module -primary-file file-01.swift -primary-file file-02.swift -o file-01.swiftmodule -o file-02.swiftmodule -module-name foo
6+
// RUN: test -e file-01.swiftmodule -a -e file-02.swiftmodule

0 commit comments

Comments
 (0)