Skip to content

Commit 9382a95

Browse files
authored
[NFC][TableGen] Adopt ArrayRef::consume_front() in PrintMessage (#146775)
Adopt `ArrayRef::consume_front()` in `PrintMessage`, and convert the loop in that function to a range for loop.
1 parent 4f1ba5a commit 9382a95

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/TableGen/Error.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ namespace llvm {
2424
SourceMgr SrcMgr;
2525
unsigned ErrorsPrinted = 0;
2626

27-
static void PrintMessage(ArrayRef<SMLoc> Loc, SourceMgr::DiagKind Kind,
27+
static void PrintMessage(ArrayRef<SMLoc> Locs, SourceMgr::DiagKind Kind,
2828
const Twine &Msg) {
2929
// Count the total number of errors printed.
3030
// This is used to exit with an error code if there were any errors.
3131
if (Kind == SourceMgr::DK_Error)
3232
++ErrorsPrinted;
3333

3434
SMLoc NullLoc;
35-
if (Loc.empty())
36-
Loc = NullLoc;
37-
SrcMgr.PrintMessage(Loc.front(), Kind, Msg);
38-
for (unsigned i = 1; i < Loc.size(); ++i)
39-
SrcMgr.PrintMessage(Loc[i], SourceMgr::DK_Note,
35+
if (Locs.empty())
36+
Locs = NullLoc;
37+
SrcMgr.PrintMessage(Locs.consume_front(), Kind, Msg);
38+
for (SMLoc Loc : Locs)
39+
SrcMgr.PrintMessage(Loc, SourceMgr::DK_Note,
4040
"instantiated from multiclass");
4141
}
4242

0 commit comments

Comments
 (0)