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:
Saleem Abdulrasool
2019-12-09 09:30:33 -08:00
parent 67423687b0
commit e2d208d358
2 changed files with 14 additions and 14 deletions

View File

@@ -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) {