mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen,Driver: extract tool usage into a variable (NFC)
autolink-extract is needed on ELF (and windows-cygnus). However, WASM also has gone down this path and did not actually indicate that it needed the autolink extract handling. Extract the handling check into a variable which helps readability.
This commit is contained in:
@@ -1153,21 +1153,17 @@ void IRGenModule::emitAutolinkInfo() {
|
||||
}),
|
||||
AutolinkEntries.end());
|
||||
|
||||
if ((TargetInfo.OutputObjectFormat == llvm::Triple::COFF &&
|
||||
!Triple.isOSCygMing()) ||
|
||||
TargetInfo.OutputObjectFormat == llvm::Triple::MachO || Triple.isPS4()) {
|
||||
const bool AutolinkExtractRequired =
|
||||
(TargetInfo.OutputObjectFormat == llvm::Triple::ELF && !Triple.isPS4()) ||
|
||||
TargetInfo.OutputObjectFormat == llvm::Triple::Wasm ||
|
||||
Triple.isOSCygMing();
|
||||
|
||||
if (!AutolinkExtractRequired) {
|
||||
// On platforms that support autolinking, continue to use the metadata.
|
||||
Metadata->clearOperands();
|
||||
for (auto *Entry : AutolinkEntries)
|
||||
Metadata->addOperand(Entry);
|
||||
|
||||
} else {
|
||||
assert((TargetInfo.OutputObjectFormat == llvm::Triple::ELF ||
|
||||
TargetInfo.OutputObjectFormat == llvm::Triple::Wasm ||
|
||||
Triple.isOSCygMing()) &&
|
||||
"expected ELF output format or COFF format for Cygwin/MinGW");
|
||||
|
||||
// Merge the entries into null-separated string.
|
||||
llvm::SmallString<64> EntriesString;
|
||||
for (auto &EntryNode : AutolinkEntries) {
|
||||
|
||||
Reference in New Issue
Block a user