File tree Expand file tree Collapse file tree 4 files changed +14
-21
lines changed Expand file tree Collapse file tree 4 files changed +14
-21
lines changed Original file line number Diff line number Diff line change @@ -56,10 +56,8 @@ class MCValue;
56
56
57
57
class MCAssembler {
58
58
public:
59
- using SectionListType = std::vector<MCSection *>;
60
-
59
+ using SectionListType = SmallVector<MCSection *, 0 >;
61
60
using const_iterator = pointee_iterator<SectionListType::const_iterator>;
62
- using iterator = pointee_iterator<SectionListType::iterator>;
63
61
64
62
// / MachO specific deployment target version info.
65
63
// A Major version of 0 indicates that no version information was supplied
@@ -326,17 +324,9 @@ class MCAssembler {
326
324
BundleAlignSize = Size;
327
325
}
328
326
329
- // / \name Section List Access
330
- // / @{
331
-
332
- iterator begin () { return Sections.begin (); }
333
327
const_iterator begin () const { return Sections.begin (); }
334
-
335
- iterator end () { return Sections.end (); }
336
328
const_iterator end () const { return Sections.end (); }
337
329
338
- size_t size () const { return Sections.size (); }
339
-
340
330
iterator_range<pointee_iterator<
341
331
typename SmallVector<const MCSymbol *, 0 >::const_iterator>>
342
332
symbols () const {
Original file line number Diff line number Diff line change @@ -1339,14 +1339,18 @@ LLVM_DUMP_METHOD void MCAssembler::dump() const{
1339
1339
1340
1340
OS << " <MCAssembler\n " ;
1341
1341
OS << " Sections:[\n " ;
1342
- for (const_iterator it = begin (), ie = end (); it != ie; ++it) {
1343
- if (it != begin ()) OS << " ,\n " ;
1344
- it->dump ();
1342
+ bool First = true ;
1343
+ for (const MCSection &Sec : *this ) {
1344
+ if (First)
1345
+ First = false ;
1346
+ else
1347
+ OS << " ,\n " ;
1348
+ Sec.dump ();
1345
1349
}
1346
1350
OS << " ],\n " ;
1347
1351
OS << " Symbols:[" ;
1348
1352
1349
- bool First = true ;
1353
+ First = true ;
1350
1354
for (const MCSymbol &Sym : symbols ()) {
1351
1355
if (First)
1352
1356
First = false ;
Original file line number Diff line number Diff line change @@ -572,9 +572,8 @@ void MachObjectWriter::computeSymbolTable(
572
572
// Build section lookup table.
573
573
DenseMap<const MCSection*, uint8_t > SectionIndexMap;
574
574
unsigned Index = 1 ;
575
- for (MCAssembler::iterator it = Asm.begin (),
576
- ie = Asm.end (); it != ie; ++it, ++Index)
577
- SectionIndexMap[&*it] = Index;
575
+ for (MCSection &Sec : Asm)
576
+ SectionIndexMap[&Sec] = Index++;
578
577
assert (Index <= 256 && " Too many sections!" );
579
578
580
579
// Build the string table.
@@ -798,7 +797,7 @@ uint64_t MachObjectWriter::writeObject(MCAssembler &Asm) {
798
797
}
799
798
}
800
799
801
- unsigned NumSections = Asm.size ();
800
+ unsigned NumSections = Asm.end () - Asm. begin ();
802
801
const MCAssembler::VersionInfoType &VersionInfo = Asm.getVersionInfo ();
803
802
804
803
// The section data starts after the header, the segment load command (and
Original file line number Diff line number Diff line change @@ -1139,8 +1139,8 @@ uint64_t WinCOFFWriter::writeObject(MCAssembler &Asm) {
1139
1139
#ifndef NDEBUG
1140
1140
sections::iterator I = Sections.begin ();
1141
1141
sections::iterator IE = Sections.end ();
1142
- MCAssembler::iterator J = Asm.begin ();
1143
- MCAssembler::iterator JE = Asm.end ();
1142
+ auto J = Asm.begin ();
1143
+ auto JE = Asm.end ();
1144
1144
for (; I != IE && J != JE; ++I, ++J) {
1145
1145
while (J != JE && ((Mode == NonDwoOnly && isDwoSection (*J)) ||
1146
1146
(Mode == DwoOnly && !isDwoSection (*J))))
You can’t perform that action at this time.
0 commit comments