@@ -1385,23 +1385,23 @@ void XCOFFObjectWriter::addExceptionEntry(
1385
1385
unsigned XCOFFObjectWriter::getExceptionSectionSize () {
1386
1386
unsigned EntryNum = 0 ;
1387
1387
1388
- for (auto it = ExceptionSection.ExceptionTable .begin ();
1389
- it != ExceptionSection.ExceptionTable .end (); ++it)
1390
- // The size() gets +1 to account for the initial entry containing the
1391
- // symbol table index.
1392
- EntryNum += it->second .Entries .size () + 1 ;
1388
+ auto CountEntries =
1389
+ [&](std::pair<const StringRef, ExceptionInfo> &ExceptionTableEntry) {
1390
+ EntryNum += ExceptionTableEntry.second .Entries .size () + 1 ;
1391
+ };
1392
+
1393
+ for_each (ExceptionSection.ExceptionTable , CountEntries);
1393
1394
1394
1395
return EntryNum * (is64Bit () ? XCOFF::ExceptionSectionEntrySize64
1395
1396
: XCOFF::ExceptionSectionEntrySize32);
1396
1397
}
1397
1398
1398
1399
unsigned XCOFFObjectWriter::getExceptionOffset (const MCSymbol *Symbol) {
1399
1400
unsigned EntryNum = 0 ;
1400
- for (auto it = ExceptionSection.ExceptionTable .begin ();
1401
- it != ExceptionSection.ExceptionTable .end (); ++it) {
1402
- if (Symbol == it->second .FunctionSymbol )
1401
+ for (const auto &TableEntry : ExceptionSection.ExceptionTable ) {
1402
+ if (Symbol == TableEntry.second .FunctionSymbol )
1403
1403
break ;
1404
- EntryNum += it-> second .Entries .size () + 1 ;
1404
+ EntryNum += TableEntry. second .Entries .size () + 1 ;
1405
1405
}
1406
1406
return EntryNum * (is64Bit () ? XCOFF::ExceptionSectionEntrySize64
1407
1407
: XCOFF::ExceptionSectionEntrySize32);
@@ -1667,17 +1667,16 @@ void XCOFFObjectWriter::writeSectionForDwarfSectionEntry(
1667
1667
void XCOFFObjectWriter::writeSectionForExceptionSectionEntry (
1668
1668
const MCAssembler &Asm, ExceptionSectionEntry &ExceptionEntry,
1669
1669
uint64_t &CurrentAddressLocation) {
1670
- for (auto it = ExceptionEntry.ExceptionTable .begin ();
1671
- it != ExceptionEntry.ExceptionTable .end (); it++) {
1670
+ for (const auto &TableEntry : ExceptionEntry.ExceptionTable ) {
1672
1671
// For every symbol that has exception entries, you must start the entries
1673
1672
// with an initial symbol table index entry
1674
- W.write <uint32_t >(SymbolIndexMap[it-> second .FunctionSymbol ]);
1673
+ W.write <uint32_t >(SymbolIndexMap[TableEntry. second .FunctionSymbol ]);
1675
1674
if (is64Bit ()) {
1676
1675
// 4-byte padding on 64-bit.
1677
1676
W.OS .write_zeros (4 );
1678
1677
}
1679
1678
W.OS .write_zeros (2 );
1680
- for (auto &TrapEntry : it-> second .Entries ) {
1679
+ for (auto &TrapEntry : TableEntry. second .Entries ) {
1681
1680
writeWord (TrapEntry.TrapAddress );
1682
1681
W.write <uint8_t >(TrapEntry.Lang );
1683
1682
W.write <uint8_t >(TrapEntry.Reason );
0 commit comments