@@ -3059,9 +3059,8 @@ bool AsmParser::parseDirectiveReloc(SMLoc DirectiveLoc) {
3059
3059
return Error (ExprLoc, " expression must be relocatable" );
3060
3060
}
3061
3061
3062
- if (parseToken (AsmToken::EndOfStatement,
3063
- " unexpected token in .reloc directive" ))
3064
- return true ;
3062
+ if (parseEOL ())
3063
+ return true ;
3065
3064
3066
3065
const MCTargetAsmParser &MCT = getTargetParser ();
3067
3066
const MCSubtargetInfo &STI = MCT.getSTI ();
@@ -3513,11 +3512,7 @@ bool AsmParser::parseDirectiveLine() {
3513
3512
(void )LineNumber;
3514
3513
// FIXME: Do something with the .line.
3515
3514
}
3516
- if (parseToken (AsmToken::EndOfStatement,
3517
- " unexpected token in '.line' directive" ))
3518
- return true ;
3519
-
3520
- return false ;
3515
+ return parseEOL ();
3521
3516
}
3522
3517
3523
3518
// / parseDirectiveLoc
@@ -4355,8 +4350,7 @@ bool AsmParser::parseDirectiveCFIReturnColumn(SMLoc DirectiveLoc) {
4355
4350
// / parseDirectiveCFISignalFrame
4356
4351
// / ::= .cfi_signal_frame
4357
4352
bool AsmParser::parseDirectiveCFISignalFrame () {
4358
- if (parseToken (AsmToken::EndOfStatement,
4359
- " unexpected token in '.cfi_signal_frame'" ))
4353
+ if (parseEOL ())
4360
4354
return true ;
4361
4355
4362
4356
getStreamer ().emitCFISignalFrame ();
@@ -4667,15 +4661,14 @@ bool AsmParser::parseDirectiveEndMacro(StringRef Directive) {
4667
4661
}
4668
4662
4669
4663
// / parseDirectivePurgeMacro
4670
- // / ::= .purgem
4664
+ // / ::= .purgem name
4671
4665
bool AsmParser::parseDirectivePurgeMacro (SMLoc DirectiveLoc) {
4672
4666
StringRef Name;
4673
4667
SMLoc Loc;
4674
4668
if (parseTokenLoc (Loc) ||
4675
4669
check (parseIdentifier (Name), Loc,
4676
4670
" expected identifier in '.purgem' directive" ) ||
4677
- parseToken (AsmToken::EndOfStatement,
4678
- " unexpected token in '.purgem' directive" ))
4671
+ parseEOL ())
4679
4672
return true ;
4680
4673
4681
4674
if (!getContext ().lookupMacro (Name))
@@ -4695,9 +4688,7 @@ bool AsmParser::parseDirectiveBundleAlignMode() {
4695
4688
SMLoc ExprLoc = getLexer ().getLoc ();
4696
4689
int64_t AlignSizePow2;
4697
4690
if (checkForValidSection () || parseAbsoluteExpression (AlignSizePow2) ||
4698
- parseToken (AsmToken::EndOfStatement, " unexpected token after expression "
4699
- " in '.bundle_align_mode' "
4700
- " directive" ) ||
4691
+ parseEOL () ||
4701
4692
check (AlignSizePow2 < 0 || AlignSizePow2 > 30 , ExprLoc,
4702
4693
" invalid bundle alignment size (expected between 0 and 30)" ))
4703
4694
return true ;
@@ -4722,9 +4713,7 @@ bool AsmParser::parseDirectiveBundleLock() {
4722
4713
4723
4714
if (!parseOptionalToken (AsmToken::EndOfStatement)) {
4724
4715
if (check (parseIdentifier (Option), Loc, kInvalidOptionError ) ||
4725
- check (Option != " align_to_end" , Loc, kInvalidOptionError ) ||
4726
- parseToken (AsmToken::EndOfStatement,
4727
- " unexpected token after '.bundle_lock' directive option" ))
4716
+ check (Option != " align_to_end" , Loc, kInvalidOptionError ) || parseEOL ())
4728
4717
return true ;
4729
4718
AlignToEnd = true ;
4730
4719
}
@@ -4799,11 +4788,7 @@ bool AsmParser::parseDirectiveDCB(StringRef IDVal, unsigned Size) {
4799
4788
getStreamer ().emitValue (Value, Size, ExprLoc);
4800
4789
}
4801
4790
4802
- if (parseToken (AsmToken::EndOfStatement,
4803
- " unexpected token in '" + Twine (IDVal) + " ' directive" ))
4804
- return true ;
4805
-
4806
- return false ;
4791
+ return parseEOL ();
4807
4792
}
4808
4793
4809
4794
// / parseDirectiveRealDCB
@@ -4824,11 +4809,7 @@ bool AsmParser::parseDirectiveRealDCB(StringRef IDVal, const fltSemantics &Seman
4824
4809
return true ;
4825
4810
4826
4811
APInt AsInt;
4827
- if (parseRealValue (Semantics, AsInt))
4828
- return true ;
4829
-
4830
- if (parseToken (AsmToken::EndOfStatement,
4831
- " unexpected token in '" + Twine (IDVal) + " ' directive" ))
4812
+ if (parseRealValue (Semantics, AsInt) || parseEOL ())
4832
4813
return true ;
4833
4814
4834
4815
for (uint64_t i = 0 , e = NumValues; i != e; ++i)
@@ -4843,18 +4824,15 @@ bool AsmParser::parseDirectiveRealDCB(StringRef IDVal, const fltSemantics &Seman
4843
4824
bool AsmParser::parseDirectiveDS (StringRef IDVal, unsigned Size) {
4844
4825
SMLoc NumValuesLoc = Lexer.getLoc ();
4845
4826
int64_t NumValues;
4846
- if (checkForValidSection () || parseAbsoluteExpression (NumValues))
4827
+ if (checkForValidSection () || parseAbsoluteExpression (NumValues) ||
4828
+ parseEOL ())
4847
4829
return true ;
4848
4830
4849
4831
if (NumValues < 0 ) {
4850
4832
Warning (NumValuesLoc, " '" + Twine (IDVal) + " ' directive with negative repeat count has no effect" );
4851
4833
return false ;
4852
4834
}
4853
4835
4854
- if (parseToken (AsmToken::EndOfStatement,
4855
- " unexpected token in '" + Twine (IDVal) + " ' directive" ))
4856
- return true ;
4857
-
4858
4836
for (uint64_t i = 0 , e = NumValues; i != e; ++i)
4859
4837
getStreamer ().emitFill (Size, 0 );
4860
4838
@@ -5271,8 +5249,7 @@ bool AsmParser::parseDirectiveElse(SMLoc DirectiveLoc) {
5271
5249
// / parseDirectiveEnd
5272
5250
// / ::= .end
5273
5251
bool AsmParser::parseDirectiveEnd (SMLoc DirectiveLoc) {
5274
- if (parseToken (AsmToken::EndOfStatement,
5275
- " unexpected token in '.end' directive" ))
5252
+ if (parseEOL ())
5276
5253
return true ;
5277
5254
5278
5255
while (Lexer.isNot (AsmToken::Eof))
@@ -5325,8 +5302,7 @@ bool AsmParser::parseDirectiveWarning(SMLoc L) {
5325
5302
5326
5303
Message = getTok ().getStringContents ();
5327
5304
Lex ();
5328
- if (parseToken (AsmToken::EndOfStatement,
5329
- " expected end of statement in '.warning' directive" ))
5305
+ if (parseEOL ())
5330
5306
return true ;
5331
5307
}
5332
5308
@@ -5598,9 +5574,7 @@ bool AsmParser::parseDirectiveRept(SMLoc DirectiveLoc, StringRef Dir) {
5598
5574
return Error (CountLoc, " unexpected token in '" + Dir + " ' directive" );
5599
5575
}
5600
5576
5601
- if (check (Count < 0 , CountLoc, " Count is negative" ) ||
5602
- parseToken (AsmToken::EndOfStatement,
5603
- " unexpected token in '" + Dir + " ' directive" ))
5577
+ if (check (Count < 0 , CountLoc, " Count is negative" ) || parseEOL ())
5604
5578
return true ;
5605
5579
5606
5580
// Lex the rept definition.
@@ -5630,8 +5604,7 @@ bool AsmParser::parseDirectiveIrp(SMLoc DirectiveLoc) {
5630
5604
if (check (parseIdentifier (Parameter.Name ),
5631
5605
" expected identifier in '.irp' directive" ) ||
5632
5606
parseToken (AsmToken::Comma, " expected comma in '.irp' directive" ) ||
5633
- parseMacroArguments (nullptr , A) ||
5634
- parseToken (AsmToken::EndOfStatement, " expected End of Statement" ))
5607
+ parseMacroArguments (nullptr , A) || parseEOL ())
5635
5608
return true ;
5636
5609
5637
5610
// Lex the irp definition.
@@ -5670,9 +5643,7 @@ bool AsmParser::parseDirectiveIrpc(SMLoc DirectiveLoc) {
5670
5643
5671
5644
if (A.size () != 1 || A.front ().size () != 1 )
5672
5645
return TokError (" unexpected token in '.irpc' directive" );
5673
-
5674
- // Eat the end of statement.
5675
- if (parseToken (AsmToken::EndOfStatement, " expected end of statement" ))
5646
+ if (parseEOL ())
5676
5647
return true ;
5677
5648
5678
5649
// Lex the irpc definition.
@@ -5751,7 +5722,7 @@ bool AsmParser::parseDirectivePrint(SMLoc DirectiveLoc) {
5751
5722
Lex ();
5752
5723
if (StrTok.isNot (AsmToken::String) || StrTok.getString ().front () != ' "' )
5753
5724
return Error (DirectiveLoc, " expected double quoted string after .print" );
5754
- if (parseToken (AsmToken::EndOfStatement, " expected end of statement " ))
5725
+ if (parseEOL ( ))
5755
5726
return true ;
5756
5727
llvm::outs () << StrTok.getStringContents () << ' \n ' ;
5757
5728
return false ;
@@ -5828,8 +5799,7 @@ bool AsmParser::parseDirectivePseudoProbe() {
5828
5799
InlineStack.push_back (Site);
5829
5800
}
5830
5801
5831
- if (parseToken (AsmToken::EndOfStatement,
5832
- " unexpected token in '.pseudoprobe' directive" ))
5802
+ if (parseEOL ())
5833
5803
return true ;
5834
5804
5835
5805
getStreamer ().emitPseudoProbe (Guid, Index, Type, Attr, InlineStack);
0 commit comments