From a1705336329af4ca39ac51534e33d9a2c3000881 Mon Sep 17 00:00:00 2001 From: Greg McGary Date: Tue, 16 Mar 2021 21:34:28 -0700 Subject: [PATCH] [lld-macho][NFC] Drop unnecessary braces around simple if/for bodies Minor cleanup Differential Revision: https://reviews.llvm.org/D98758 --- lld/MachO/LTO.cpp | 3 +-- lld/MachO/MergedOutputSection.cpp | 3 +-- lld/MachO/OutputSegment.cpp | 3 +-- lld/MachO/SymbolTable.cpp | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lld/MachO/LTO.cpp b/lld/MachO/LTO.cpp index 0cf5328e2d6c..38d4e55cfcaf 100644 --- a/lld/MachO/LTO.cpp +++ b/lld/MachO/LTO.cpp @@ -99,9 +99,8 @@ std::vector BitcodeCompiler::compile() { std::vector ret; for (unsigned i = 0; i != maxTasks; ++i) { - if (buf[i].empty()) { + if (buf[i].empty()) continue; - } SmallString<261> filePath("/tmp/lto.tmp"); uint32_t modTime = 0; if (!config->ltoObjPath.empty()) { diff --git a/lld/MachO/MergedOutputSection.cpp b/lld/MachO/MergedOutputSection.cpp index 15e957250dd0..9a74925ce967 100644 --- a/lld/MachO/MergedOutputSection.cpp +++ b/lld/MachO/MergedOutputSection.cpp @@ -45,9 +45,8 @@ void MergedOutputSection::finalize() { } void MergedOutputSection::writeTo(uint8_t *buf) const { - for (InputSection *isec : inputs) { + for (InputSection *isec : inputs) isec->writeTo(buf + isec->outSecFileOff); - } } // TODO: this is most likely wrong; reconsider how section flags diff --git a/lld/MachO/OutputSegment.cpp b/lld/MachO/OutputSegment.cpp index 1ea5d49a32a1..edfc474d3df2 100644 --- a/lld/MachO/OutputSegment.cpp +++ b/lld/MachO/OutputSegment.cpp @@ -38,9 +38,8 @@ static uint32_t maxProt(StringRef name) { size_t OutputSegment::numNonHiddenSections() const { size_t count = 0; - for (const OutputSection *osec : sections) { + for (const OutputSection *osec : sections) count += (!osec->isHidden() ? 1 : 0); - } return count; } diff --git a/lld/MachO/SymbolTable.cpp b/lld/MachO/SymbolTable.cpp index 43e324ab5f47..1d812538005d 100644 --- a/lld/MachO/SymbolTable.cpp +++ b/lld/MachO/SymbolTable.cpp @@ -54,11 +54,10 @@ Defined *SymbolTable::addDefined(StringRef name, InputFile *file, defined->privateExtern &= isPrivateExtern; return defined; } - if (!defined->isWeakDef()) { + if (!defined->isWeakDef()) error("duplicate symbol: " + name + "\n>>> defined in " + toString(defined->getFile()) + "\n>>> defined in " + toString(file)); - } } else if (auto *dysym = dyn_cast(s)) { overridesWeakDef = !isWeakDef && dysym->isWeakDef(); }