@@ -833,11 +833,8 @@ AsmParser::~AsmParser() {
833
833
834
834
void AsmParser::printMacroInstantiations () {
835
835
// Print the active macro instantiation stack.
836
- for (std::vector<MacroInstantiation *>::const_reverse_iterator
837
- it = ActiveMacros.rbegin (),
838
- ie = ActiveMacros.rend ();
839
- it != ie; ++it)
840
- printMessage ((*it)->InstantiationLoc , SourceMgr::DK_Note,
836
+ for (MacroInstantiation *M : reverse (ActiveMacros))
837
+ printMessage (M->InstantiationLoc , SourceMgr::DK_Note,
841
838
" while in macro instantiation" );
842
839
}
843
840
@@ -1510,9 +1507,7 @@ bool AsmParser::parseExpression(const MCExpr *&Res, SMLoc &EndLoc) {
1510
1507
// As a special case, we support 'a op b @ modifier' by rewriting the
1511
1508
// expression to include the modifier. This is inefficient, but in general we
1512
1509
// expect users to use 'a@modifier op b'.
1513
- if (Lexer.getKind () == AsmToken::At) {
1514
- Lex ();
1515
-
1510
+ if (parseOptionalToken (AsmToken::At)) {
1516
1511
if (Lexer.isNot (AsmToken::Identifier))
1517
1512
return TokError (" unexpected symbol modifier following '@'" );
1518
1513
@@ -2708,10 +2703,8 @@ bool AsmParser::parseMacroArgument(MCAsmMacroArgument &MA, bool Vararg) {
2708
2703
if (Lexer.is (AsmToken::Comma))
2709
2704
break ;
2710
2705
2711
- if (Lexer. is (AsmToken::Space)) {
2706
+ if (parseOptionalToken (AsmToken::Space))
2712
2707
SpaceEaten = true ;
2713
- Lexer.Lex (); // Eat spaces
2714
- }
2715
2708
2716
2709
// Spaces can delimit parameters, but could also be part an expression.
2717
2710
// If the token after a space is an operator, add the token and the next
@@ -2722,9 +2715,7 @@ bool AsmParser::parseMacroArgument(MCAsmMacroArgument &MA, bool Vararg) {
2722
2715
Lexer.Lex ();
2723
2716
2724
2717
// Whitespace after an operator can be ignored.
2725
- if (Lexer.is (AsmToken::Space))
2726
- Lexer.Lex ();
2727
-
2718
+ parseOptionalToken (AsmToken::Space);
2728
2719
continue ;
2729
2720
}
2730
2721
}
@@ -2865,8 +2856,7 @@ bool AsmParser::parseMacroArguments(const MCAsmMacro *M,
2865
2856
return Failure;
2866
2857
}
2867
2858
2868
- if (Lexer.is (AsmToken::Comma))
2869
- Lex ();
2859
+ parseOptionalToken (AsmToken::Comma);
2870
2860
}
2871
2861
2872
2862
return TokError (" too many positional arguments" );
0 commit comments