[lld] a170533 - [lld-macho][NFC] Drop unnecessary braces around simple if/for bodies
Greg McGary via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 16 22:39:48 PDT 2021
Author: Greg McGary
Date: 2021-03-16T22:39:39-07:00
New Revision: a1705336329af4ca39ac51534e33d9a2c3000881
URL: https://github.com/llvm/llvm-project/commit/a1705336329af4ca39ac51534e33d9a2c3000881
DIFF: https://github.com/llvm/llvm-project/commit/a1705336329af4ca39ac51534e33d9a2c3000881.diff
LOG: [lld-macho][NFC] Drop unnecessary braces around simple if/for bodies
Minor cleanup
Differential Revision: https://reviews.llvm.org/D98758
Added:
Modified:
lld/MachO/LTO.cpp
lld/MachO/MergedOutputSection.cpp
lld/MachO/OutputSegment.cpp
lld/MachO/SymbolTable.cpp
Removed:
################################################################################
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<ObjFile *> BitcodeCompiler::compile() {
std::vector<ObjFile *> 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<DylibSymbol>(s)) {
overridesWeakDef = !isWeakDef && dysym->isWeakDef();
}
More information about the llvm-commits
mailing list