Skip to content

Commit 6b8763d

Browse files
committed
[MC,COFF] Don't evaluate end() every iteration
In accordance with https://llvm.org/docs/CodingStandards.html we shouldn't do this.
1 parent 915372a commit 6b8763d

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

llvm/lib/MC/XCOFFObjectWriter.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,23 +1385,25 @@ void XCOFFObjectWriter::addExceptionEntry(
13851385
unsigned XCOFFObjectWriter::getExceptionSectionSize() {
13861386
unsigned EntryNum = 0;
13871387

1388-
for (auto it = ExceptionSection.ExceptionTable.begin();
1389-
it != ExceptionSection.ExceptionTable.end(); ++it)
1388+
for (auto I = ExceptionSection.ExceptionTable.begin(),
1389+
E = ExceptionSection.ExceptionTable.end();
1390+
I != E; ++I)
13901391
// The size() gets +1 to account for the initial entry containing the
13911392
// symbol table index.
1392-
EntryNum += it->second.Entries.size() + 1;
1393+
EntryNum += I->second.Entries.size() + 1;
13931394

13941395
return EntryNum * (is64Bit() ? XCOFF::ExceptionSectionEntrySize64
13951396
: XCOFF::ExceptionSectionEntrySize32);
13961397
}
13971398

13981399
unsigned XCOFFObjectWriter::getExceptionOffset(const MCSymbol *Symbol) {
13991400
unsigned EntryNum = 0;
1400-
for (auto it = ExceptionSection.ExceptionTable.begin();
1401-
it != ExceptionSection.ExceptionTable.end(); ++it) {
1402-
if (Symbol == it->second.FunctionSymbol)
1401+
for (auto I = ExceptionSection.ExceptionTable.begin(),
1402+
E = ExceptionSection.ExceptionTable.end();
1403+
I != E; ++I) {
1404+
if (Symbol == I->second.FunctionSymbol)
14031405
break;
1404-
EntryNum += it->second.Entries.size() + 1;
1406+
EntryNum += I->second.Entries.size() + 1;
14051407
}
14061408
return EntryNum * (is64Bit() ? XCOFF::ExceptionSectionEntrySize64
14071409
: XCOFF::ExceptionSectionEntrySize32);
@@ -1667,17 +1669,18 @@ void XCOFFObjectWriter::writeSectionForDwarfSectionEntry(
16671669
void XCOFFObjectWriter::writeSectionForExceptionSectionEntry(
16681670
const MCAssembler &Asm, ExceptionSectionEntry &ExceptionEntry,
16691671
uint64_t &CurrentAddressLocation) {
1670-
for (auto it = ExceptionEntry.ExceptionTable.begin();
1671-
it != ExceptionEntry.ExceptionTable.end(); it++) {
1672+
for (auto I = ExceptionEntry.ExceptionTable.begin(),
1673+
E = ExceptionEntry.ExceptionTable.end();
1674+
I != E; ++I) {
16721675
// For every symbol that has exception entries, you must start the entries
16731676
// with an initial symbol table index entry
1674-
W.write<uint32_t>(SymbolIndexMap[it->second.FunctionSymbol]);
1677+
W.write<uint32_t>(SymbolIndexMap[I->second.FunctionSymbol]);
16751678
if (is64Bit()) {
16761679
// 4-byte padding on 64-bit.
16771680
W.OS.write_zeros(4);
16781681
}
16791682
W.OS.write_zeros(2);
1680-
for (auto &TrapEntry : it->second.Entries) {
1683+
for (auto &TrapEntry : I->second.Entries) {
16811684
writeWord(TrapEntry.TrapAddress);
16821685
W.write<uint8_t>(TrapEntry.Lang);
16831686
W.write<uint8_t>(TrapEntry.Reason);

0 commit comments

Comments
 (0)