diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/MC/MCAssembler.h | 12 | ||||
-rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/MC/MachObjectWriter.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/MC/WinCOFFObjectWriter.cpp | 4 |
4 files changed, 14 insertions, 21 deletions
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h index 8a8f0d4..4b08d50 100644 --- a/llvm/include/llvm/MC/MCAssembler.h +++ b/llvm/include/llvm/MC/MCAssembler.h @@ -56,10 +56,8 @@ class MCValue; class MCAssembler { public: - using SectionListType = std::vector<MCSection *>; - + using SectionListType = SmallVector<MCSection *, 0>; using const_iterator = pointee_iterator<SectionListType::const_iterator>; - using iterator = pointee_iterator<SectionListType::iterator>; /// MachO specific deployment target version info. // A Major version of 0 indicates that no version information was supplied @@ -326,17 +324,9 @@ public: BundleAlignSize = Size; } - /// \name Section List Access - /// @{ - - iterator begin() { return Sections.begin(); } const_iterator begin() const { return Sections.begin(); } - - iterator end() { return Sections.end(); } const_iterator end() const { return Sections.end(); } - size_t size() const { return Sections.size(); } - iterator_range<pointee_iterator< typename SmallVector<const MCSymbol *, 0>::const_iterator>> symbols() const { diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 3c77779..c8d12eb 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -1339,14 +1339,18 @@ LLVM_DUMP_METHOD void MCAssembler::dump() const{ OS << "<MCAssembler\n"; OS << " Sections:[\n "; - for (const_iterator it = begin(), ie = end(); it != ie; ++it) { - if (it != begin()) OS << ",\n "; - it->dump(); + bool First = true; + for (const MCSection &Sec : *this) { + if (First) + First = false; + else + OS << ",\n "; + Sec.dump(); } OS << "],\n"; OS << " Symbols:["; - bool First = true; + First = true; for (const MCSymbol &Sym : symbols()) { if (First) First = false; diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp index 14f7f0d..53eed00 100644 --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/lib/MC/MachObjectWriter.cpp @@ -572,9 +572,8 @@ void MachObjectWriter::computeSymbolTable( // Build section lookup table. DenseMap<const MCSection*, uint8_t> SectionIndexMap; unsigned Index = 1; - for (MCAssembler::iterator it = Asm.begin(), - ie = Asm.end(); it != ie; ++it, ++Index) - SectionIndexMap[&*it] = Index; + for (MCSection &Sec : Asm) + SectionIndexMap[&Sec] = Index++; assert(Index <= 256 && "Too many sections!"); // Build the string table. @@ -798,7 +797,7 @@ uint64_t MachObjectWriter::writeObject(MCAssembler &Asm) { } } - unsigned NumSections = Asm.size(); + unsigned NumSections = Asm.end() - Asm.begin(); const MCAssembler::VersionInfoType &VersionInfo = Asm.getVersionInfo(); // The section data starts after the header, the segment load command (and diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp index c0bad19..7ba38be 100644 --- a/llvm/lib/MC/WinCOFFObjectWriter.cpp +++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp @@ -1139,8 +1139,8 @@ uint64_t WinCOFFWriter::writeObject(MCAssembler &Asm) { #ifndef NDEBUG sections::iterator I = Sections.begin(); sections::iterator IE = Sections.end(); - MCAssembler::iterator J = Asm.begin(); - MCAssembler::iterator JE = Asm.end(); + auto J = Asm.begin(); + auto JE = Asm.end(); for (; I != IE && J != JE; ++I, ++J) { while (J != JE && ((Mode == NonDwoOnly && isDwoSection(*J)) || (Mode == DwoOnly && !isDwoSection(*J)))) |