From 923c60906be60fc1ed2bdf9f84c0607cd59fc521 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 26 Jan 2021 20:00:19 -0800 Subject: [PATCH] [llvm-objdump] Use append_range (NFC) --- tools/llvm-objdump/COFFDump.cpp | 3 +-- tools/llvm-objdump/MachODump.cpp | 15 +++++---------- tools/llvm-objdump/llvm-objdump.cpp | 3 +-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/tools/llvm-objdump/COFFDump.cpp b/tools/llvm-objdump/COFFDump.cpp index b9d69d62e4e..09a900182d2 100644 --- a/tools/llvm-objdump/COFFDump.cpp +++ b/tools/llvm-objdump/COFFDump.cpp @@ -454,8 +454,7 @@ static bool getPDataSection(const COFFObjectFile *Obj, continue; const coff_section *Pdata = Obj->getCOFFSection(Section); - for (const RelocationRef &Reloc : Section.relocations()) - Rels.push_back(Reloc); + append_range(Rels, Section.relocations()); // Sort relocations by address. llvm::sort(Rels, isRelocAddressLess); diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index 51212d52c18..41a7d07406f 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -362,8 +362,7 @@ static void getSectionsAndSymbols(MachOObjectFile *MachOObj, Symbols.push_back(Symbol); } - for (const SectionRef &Section : MachOObj->sections()) - Sections.push_back(Section); + append_range(Sections, MachOObj->sections()); bool BaseSegmentAddressSet = false; for (const auto &Command : MachOObj->load_commands()) { @@ -6115,8 +6114,7 @@ static void printObjc2_64bit_MetaData(MachOObjectFile *O, bool verbose) { CreateSymbolAddressMap(O, &AddrMap); std::vector Sections; - for (const SectionRef &Section : O->sections()) - Sections.push_back(Section); + append_range(Sections, O->sections()); struct DisassembleInfo info(O, &AddrMap, &Sections, verbose); @@ -6197,8 +6195,7 @@ static void printObjc2_32bit_MetaData(MachOObjectFile *O, bool verbose) { CreateSymbolAddressMap(O, &AddrMap); std::vector Sections; - for (const SectionRef &Section : O->sections()) - Sections.push_back(Section); + append_range(Sections, O->sections()); struct DisassembleInfo info(O, &AddrMap, &Sections, verbose); @@ -6292,8 +6289,7 @@ static bool printObjc1_32bit_MetaData(MachOObjectFile *O, bool verbose) { CreateSymbolAddressMap(O, &AddrMap); std::vector Sections; - for (const SectionRef &Section : O->sections()) - Sections.push_back(Section); + append_range(Sections, O->sections()); struct DisassembleInfo info(O, &AddrMap, &Sections, verbose); @@ -6450,8 +6446,7 @@ static void DumpProtocolSection(MachOObjectFile *O, const char *sect, CreateSymbolAddressMap(O, &AddrMap); std::vector Sections; - for (const SectionRef &Section : O->sections()) - Sections.push_back(Section); + append_range(Sections, O->sections()); struct DisassembleInfo info(O, &AddrMap, &Sections, true); diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 3134f989603..4b2a159ddd0 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -1479,8 +1479,7 @@ getRelocsMap(object::ObjectFile const &Obj) { if (Relocated == Obj.section_end() || !checkSectionFilter(*Relocated).Keep) continue; std::vector &V = Ret[*Relocated]; - for (const RelocationRef &R : Sec.relocations()) - V.push_back(R); + append_range(V, Sec.relocations()); // Sort relocations by address. llvm::stable_sort(V, isRelocAddressLess); }