From c0ec1036d6532143998fa393b5a469b4a5e964ff Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Tue, 24 May 2022 07:59:18 +0700 Subject: [PATCH] [lld-macho][nfc] Run clang-format on lld/MachO/*.{h,cpp} - fixed inconsistent indents and spaces - prevent extraneous formatting changes in other patches Differential Revision: https://reviews.llvm.org/D126262 --- lld/MachO/ConcatOutputSection.cpp | 4 ++-- lld/MachO/InputFiles.cpp | 7 +++---- lld/MachO/InputSection.h | 3 ++- lld/MachO/MarkLive.cpp | 3 +-- lld/MachO/OutputSection.cpp | 4 +--- lld/MachO/SyntheticSections.cpp | 4 ++-- lld/MachO/Writer.cpp | 2 +- 7 files changed, 12 insertions(+), 15 deletions(-) diff --git a/lld/MachO/ConcatOutputSection.cpp b/lld/MachO/ConcatOutputSection.cpp index 73222ee..ed709a3 100644 --- a/lld/MachO/ConcatOutputSection.cpp +++ b/lld/MachO/ConcatOutputSection.cpp @@ -328,8 +328,8 @@ void TextOutputSection::finalize() { std::to_string(thunkInfo.sequence++)); if (!isa(funcSym) || cast(funcSym)->isExternal()) { r.referent = thunkInfo.sym = symtab->addDefined( - thunkName, /*file=*/nullptr, thunkInfo.isec, /*value=*/0, - thunkSize, /*isWeakDef=*/false, /*isPrivateExtern=*/true, + thunkName, /*file=*/nullptr, thunkInfo.isec, /*value=*/0, thunkSize, + /*isWeakDef=*/false, /*isPrivateExtern=*/true, /*isThumb=*/false, /*isReferencedDynamically=*/false, /*noDeadStrip=*/false, /*isWeakDefCanBeHidden=*/false); } else { diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp index f0cd426..05f491e 100644 --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -258,8 +258,8 @@ InputFile::InputFile(Kind kind, const InterfaceFile &interface) // used by the Mach-O format. static Optional getRecordSize(StringRef segname, StringRef name) { if (name == section_names::compactUnwind) { - if (segname == segment_names::ld) - return target->wordSize == 8 ? 32 : 20; + if (segname == segment_names::ld) + return target->wordSize == 8 ? 32 : 20; } if (config->icfLevel == ICFLevel::none) return {}; @@ -439,8 +439,7 @@ static bool validateRelocationInfo(InputFile *file, const SectionHeader &sec, template void ObjFile::parseRelocations(ArrayRef sectionHeaders, - const SectionHeader &sec, - Section §ion) { + const SectionHeader &sec, Section §ion) { auto *buf = reinterpret_cast(mb.getBufferStart()); ArrayRef relInfos( reinterpret_cast(buf + sec.reloff), sec.nreloc); diff --git a/lld/MachO/InputSection.h b/lld/MachO/InputSection.h index c4366c2..e018443 100644 --- a/lld/MachO/InputSection.h +++ b/lld/MachO/InputSection.h @@ -71,7 +71,8 @@ protected: public: // is address assigned? bool isFinal = false; - // keep the address of the symbol(s) in this section unique in the final binary ? + // keep the address of the symbol(s) in this section unique in the final + // binary ? bool keepUnique = false; uint32_t align = 1; diff --git a/lld/MachO/MarkLive.cpp b/lld/MachO/MarkLive.cpp index 9cae677..7239e30 100644 --- a/lld/MachO/MarkLive.cpp +++ b/lld/MachO/MarkLive.cpp @@ -165,8 +165,7 @@ void MarkLiveImpl::markTransitively() { // contain other types of InputSections (due to S_ATTR_LIVE_SUPPORT), but // those entries should never be pushed onto the worklist. auto *isec = cast(getInputSection(entry)); - assert(isec->live && - "We mark as live when pushing onto the worklist!"); + assert(isec->live && "We mark as live when pushing onto the worklist!"); // Mark all symbols listed in the relocation table for this section. for (const Reloc &r : isec->relocs) { diff --git a/lld/MachO/OutputSection.cpp b/lld/MachO/OutputSection.cpp index 8d7a29c..461d4f8 100644 --- a/lld/MachO/OutputSection.cpp +++ b/lld/MachO/OutputSection.cpp @@ -13,9 +13,7 @@ using namespace llvm; using namespace lld; using namespace lld::macho; -uint64_t OutputSection::getSegmentOffset() const { - return addr - parent->addr; -} +uint64_t OutputSection::getSegmentOffset() const { return addr - parent->addr; } void OutputSection::assignAddressesToStartEndSymbols() { for (Defined *d : sectionStartSymbols) diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp index 7e1d92b..61597cc 100644 --- a/lld/MachO/SyntheticSections.cpp +++ b/lld/MachO/SyntheticSections.cpp @@ -704,8 +704,8 @@ uint32_t LazyBindingSection::encode(const Symbol &sym) { OutputSegment *dataSeg = in.lazyPointers->parent; os << static_cast(BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB | dataSeg->index); - uint64_t offset = in.lazyPointers->addr - dataSeg->addr + - sym.stubsIndex * target->wordSize; + uint64_t offset = + in.lazyPointers->addr - dataSeg->addr + sym.stubsIndex * target->wordSize; encodeULEB128(offset, os); encodeDylibOrdinal(ordinalForSymbol(sym), os); diff --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp index ac36630..3fbf520 100644 --- a/lld/MachO/Writer.cpp +++ b/lld/MachO/Writer.cpp @@ -990,7 +990,7 @@ void Writer::finalizeAddresses() { continue; // Other kinds of OutputSections have already been finalized. if (auto concatOsec = dyn_cast(osec)) - concatOsec->finalizeContents(); + concatOsec->finalizeContents(); } } -- 2.7.4