Skip to content

Commit 4b9c1ef

Browse files
committed
[MC,AsmParser] Don't evaluate end() every iteration
In accordance with https://llvm.org/docs/CodingStandards.html we shouldn't do this.
1 parent 222b654 commit 4b9c1ef

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

llvm/lib/MC/MCParser/AsmParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6116,8 +6116,8 @@ bool AsmParser::parseMSInlineAsm(
61166116
const char *AsmStart = ASMString.begin();
61176117
const char *AsmEnd = ASMString.end();
61186118
array_pod_sort(AsmStrRewrites.begin(), AsmStrRewrites.end(), rewritesSort);
6119-
for (auto it = AsmStrRewrites.begin(); it != AsmStrRewrites.end(); ++it) {
6120-
const AsmRewrite &AR = *it;
6119+
for (auto I = AsmStrRewrites.begin(), E = AsmStrRewrites.end(); I != E; ++I) {
6120+
const AsmRewrite &AR = *I;
61216121
// Check if this has already been covered by another rewrite...
61226122
if (AR.Done)
61236123
continue;
@@ -6160,7 +6160,7 @@ bool AsmParser::parseMSInlineAsm(
61606160
SMLoc OffsetLoc = SMLoc::getFromPointer(AR.IntelExp.OffsetName.data());
61616161
size_t OffsetLen = OffsetName.size();
61626162
auto rewrite_it = std::find_if(
6163-
it, AsmStrRewrites.end(), [&](const AsmRewrite &FusingAR) {
6163+
I, AsmStrRewrites.end(), [&](const AsmRewrite &FusingAR) {
61646164
return FusingAR.Loc == OffsetLoc && FusingAR.Len == OffsetLen &&
61656165
(FusingAR.Kind == AOK_Input ||
61666166
FusingAR.Kind == AOK_CallInput);

llvm/lib/MC/MCParser/MasmParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7474,8 +7474,8 @@ bool MasmParser::parseMSInlineAsm(
74747474
const char *AsmStart = ASMString.begin();
74757475
const char *AsmEnd = ASMString.end();
74767476
array_pod_sort(AsmStrRewrites.begin(), AsmStrRewrites.end(), rewritesSort);
7477-
for (auto it = AsmStrRewrites.begin(); it != AsmStrRewrites.end(); ++it) {
7478-
const AsmRewrite &AR = *it;
7477+
for (auto I = AsmStrRewrites.begin(), E = AsmStrRewrites.end(); I != E; ++I) {
7478+
const AsmRewrite &AR = *I;
74797479
// Check if this has already been covered by another rewrite...
74807480
if (AR.Done)
74817481
continue;
@@ -7518,7 +7518,7 @@ bool MasmParser::parseMSInlineAsm(
75187518
SMLoc OffsetLoc = SMLoc::getFromPointer(AR.IntelExp.OffsetName.data());
75197519
size_t OffsetLen = OffsetName.size();
75207520
auto rewrite_it = std::find_if(
7521-
it, AsmStrRewrites.end(), [&](const AsmRewrite &FusingAR) {
7521+
I, AsmStrRewrites.end(), [&](const AsmRewrite &FusingAR) {
75227522
return FusingAR.Loc == OffsetLoc && FusingAR.Len == OffsetLen &&
75237523
(FusingAR.Kind == AOK_Input ||
75247524
FusingAR.Kind == AOK_CallInput);

0 commit comments

Comments
 (0)