@@ -4949,8 +4949,7 @@ bool MasmParser::parseDirectiveLine() {
4949
4949
(void )LineNumber;
4950
4950
// FIXME: Do something with the .line.
4951
4951
}
4952
- if (parseToken (AsmToken::EndOfStatement,
4953
- " unexpected token in '.line' directive" ))
4952
+ if (parseEOL ())
4954
4953
return true ;
4955
4954
4956
4955
return false ;
@@ -5083,8 +5082,7 @@ bool MasmParser::parseDirectiveCVFile() {
5083
5082
parseEscapedString (Checksum) ||
5084
5083
parseIntToken (ChecksumKind,
5085
5084
" expected checksum kind in '.cv_file' directive" ) ||
5086
- parseToken (AsmToken::EndOfStatement,
5087
- " unexpected token in '.cv_file' directive" ))
5085
+ parseEOL ())
5088
5086
return true ;
5089
5087
}
5090
5088
@@ -5130,9 +5128,7 @@ bool MasmParser::parseDirectiveCVFuncId() {
5130
5128
SMLoc FunctionIdLoc = getTok ().getLoc ();
5131
5129
int64_t FunctionId;
5132
5130
5133
- if (parseCVFunctionId (FunctionId, " .cv_func_id" ) ||
5134
- parseToken (AsmToken::EndOfStatement,
5135
- " unexpected token in '.cv_func_id' directive" ))
5131
+ if (parseCVFunctionId (FunctionId, " .cv_func_id" ) || parseEOL ())
5136
5132
return true ;
5137
5133
5138
5134
if (!getStreamer ().emitCVFuncIdDirective (FunctionId))
@@ -5191,8 +5187,7 @@ bool MasmParser::parseDirectiveCVInlineSiteId() {
5191
5187
Lex ();
5192
5188
}
5193
5189
5194
- if (parseToken (AsmToken::EndOfStatement,
5195
- " unexpected token in '.cv_inline_site_id' directive" ))
5190
+ if (parseEOL ())
5196
5191
return true ;
5197
5192
5198
5193
if (!getStreamer ().emitCVInlineSiteIdDirective (FunctionId, IAFunc, IAFile,
@@ -5318,7 +5313,7 @@ bool MasmParser::parseDirectiveCVInlineLinetable() {
5318
5313
" expected identifier in directive" ))
5319
5314
return true ;
5320
5315
5321
- if (parseToken (AsmToken::EndOfStatement, " Expected End of Statement " ))
5316
+ if (parseEOL ( ))
5322
5317
return true ;
5323
5318
5324
5319
MCSymbol *FnStartSym = getContext ().getOrCreateSymbol (FnStartName);
@@ -5479,7 +5474,7 @@ bool MasmParser::parseDirectiveCVFileChecksumOffset() {
5479
5474
int64_t FileNo;
5480
5475
if (parseIntToken (FileNo, " expected identifier in directive" ))
5481
5476
return true ;
5482
- if (parseToken (AsmToken::EndOfStatement, " Expected End of Statement " ))
5477
+ if (parseEOL ( ))
5483
5478
return true ;
5484
5479
getStreamer ().emitCVFileChecksumOffsetDirective (FileNo);
5485
5480
return false ;
@@ -5788,8 +5783,7 @@ bool MasmParser::parseDirectiveCFIReturnColumn(SMLoc DirectiveLoc) {
5788
5783
// / parseDirectiveCFISignalFrame
5789
5784
// / ::= .cfi_signal_frame
5790
5785
bool MasmParser::parseDirectiveCFISignalFrame () {
5791
- if (parseToken (AsmToken::EndOfStatement,
5792
- " unexpected token in '.cfi_signal_frame'" ))
5786
+ if (parseEOL ())
5793
5787
return true ;
5794
5788
5795
5789
getStreamer ().emitCFISignalFrame ();
@@ -6121,8 +6115,7 @@ bool MasmParser::parseDirectiveComm(bool IsLocal) {
6121
6115
}
6122
6116
}
6123
6117
6124
- if (parseToken (AsmToken::EndOfStatement,
6125
- " unexpected token in '.comm' or '.lcomm' directive" ))
6118
+ if (parseEOL ())
6126
6119
return true ;
6127
6120
6128
6121
// NOTE: a size of zero for a .comm should create a undefined symbol
@@ -6168,8 +6161,7 @@ bool MasmParser::parseDirectiveComment(SMLoc DirectiveLoc) {
6168
6161
Lex (); // eat end of statement
6169
6162
} while (
6170
6163
!StringRef (parseStringTo (AsmToken::EndOfStatement)).contains (Delimiter));
6171
- return parseToken (AsmToken::EndOfStatement,
6172
- " unexpected token in 'comment' directive" );
6164
+ return parseEOL ();
6173
6165
}
6174
6166
6175
6167
// / parseDirectiveInclude
@@ -6203,9 +6195,7 @@ bool MasmParser::parseDirectiveIf(SMLoc DirectiveLoc, DirectiveKind DirKind) {
6203
6195
eatToEndOfStatement ();
6204
6196
} else {
6205
6197
int64_t ExprValue;
6206
- if (parseAbsoluteExpression (ExprValue) ||
6207
- parseToken (AsmToken::EndOfStatement,
6208
- " unexpected token in '.if' directive" ))
6198
+ if (parseAbsoluteExpression (ExprValue) || parseEOL ())
6209
6199
return true ;
6210
6200
6211
6201
switch (DirKind) {
@@ -6238,8 +6228,7 @@ bool MasmParser::parseDirectiveIfb(SMLoc DirectiveLoc, bool ExpectBlank) {
6238
6228
if (parseTextItem (Str))
6239
6229
return TokError (" expected text item parameter for 'ifb' directive" );
6240
6230
6241
- if (parseToken (AsmToken::EndOfStatement,
6242
- " unexpected token in 'ifb' directive" ))
6231
+ if (parseEOL ())
6243
6232
return true ;
6244
6233
6245
6234
TheCondState.CondMet = ExpectBlank == Str.empty ();
@@ -6305,7 +6294,7 @@ bool MasmParser::parseDirectiveIfdef(SMLoc DirectiveLoc, bool expect_defined) {
6305
6294
if (!is_defined) {
6306
6295
StringRef Name;
6307
6296
if (check (parseIdentifier (Name), " expected identifier after 'ifdef'" ) ||
6308
- parseToken (AsmToken::EndOfStatement, " unexpected token in 'ifdef' " ))
6297
+ parseEOL ( ))
6309
6298
return true ;
6310
6299
6311
6300
if (BuiltinSymbolMap.find (Name.lower ()) != BuiltinSymbolMap.end ()) {
@@ -6346,8 +6335,7 @@ bool MasmParser::parseDirectiveElseIf(SMLoc DirectiveLoc,
6346
6335
if (parseAbsoluteExpression (ExprValue))
6347
6336
return true ;
6348
6337
6349
- if (parseToken (AsmToken::EndOfStatement,
6350
- " unexpected token in '.elseif' directive" ))
6338
+ if (parseEOL ())
6351
6339
return true ;
6352
6340
6353
6341
switch (DirKind) {
@@ -6390,8 +6378,7 @@ bool MasmParser::parseDirectiveElseIfb(SMLoc DirectiveLoc, bool ExpectBlank) {
6390
6378
return TokError (" expected text item parameter for 'elseifnb' directive" );
6391
6379
}
6392
6380
6393
- if (parseToken (AsmToken::EndOfStatement,
6394
- " unexpected token in 'elseifb' directive" ))
6381
+ if (parseEOL ())
6395
6382
return true ;
6396
6383
6397
6384
TheCondState.CondMet = ExpectBlank == Str.empty ();
@@ -6428,8 +6415,7 @@ bool MasmParser::parseDirectiveElseIfdef(SMLoc DirectiveLoc,
6428
6415
StringRef Name;
6429
6416
if (check (parseIdentifier (Name),
6430
6417
" expected identifier after 'elseifdef'" ) ||
6431
- parseToken (AsmToken::EndOfStatement,
6432
- " unexpected token in 'elseifdef'" ))
6418
+ parseEOL ())
6433
6419
return true ;
6434
6420
6435
6421
if (BuiltinSymbolMap.find (Name.lower ()) != BuiltinSymbolMap.end ()) {
@@ -6505,8 +6491,7 @@ bool MasmParser::parseDirectiveElseIfidn(SMLoc DirectiveLoc, bool ExpectEqual,
6505
6491
// / parseDirectiveElse
6506
6492
// / ::= else
6507
6493
bool MasmParser::parseDirectiveElse (SMLoc DirectiveLoc) {
6508
- if (parseToken (AsmToken::EndOfStatement,
6509
- " unexpected token in 'else' directive" ))
6494
+ if (parseEOL ())
6510
6495
return true ;
6511
6496
6512
6497
if (TheCondState.TheCond != AsmCond::IfCond &&
@@ -6528,8 +6513,7 @@ bool MasmParser::parseDirectiveElse(SMLoc DirectiveLoc) {
6528
6513
// / parseDirectiveEnd
6529
6514
// / ::= end
6530
6515
bool MasmParser::parseDirectiveEnd (SMLoc DirectiveLoc) {
6531
- if (parseToken (AsmToken::EndOfStatement,
6532
- " unexpected token in 'end' directive" ))
6516
+ if (parseEOL ())
6533
6517
return true ;
6534
6518
6535
6519
while (Lexer.isNot (AsmToken::Eof))
@@ -6717,8 +6701,7 @@ bool MasmParser::parseDirectiveErrorIfe(SMLoc DirectiveLoc, bool ExpectZero) {
6717
6701
// / parseDirectiveEndIf
6718
6702
// / ::= .endif
6719
6703
bool MasmParser::parseDirectiveEndIf (SMLoc DirectiveLoc) {
6720
- if (parseToken (AsmToken::EndOfStatement,
6721
- " unexpected token in '.endif' directive" ))
6704
+ if (parseEOL ())
6722
6705
return true ;
6723
6706
6724
6707
if ((TheCondState.TheCond == AsmCond::NoCond) || TheCondStack.empty ())
@@ -7012,9 +6995,7 @@ bool MasmParser::parseDirectiveRepeat(SMLoc DirectiveLoc, StringRef Dir) {
7012
6995
return Error (CountLoc, " unexpected token in '" + Dir + " ' directive" );
7013
6996
}
7014
6997
7015
- if (check (Count < 0 , CountLoc, " Count is negative" ) ||
7016
- parseToken (AsmToken::EndOfStatement,
7017
- " unexpected token in '" + Dir + " ' directive" ))
6998
+ if (check (Count < 0 , CountLoc, " Count is negative" ) || parseEOL ())
7018
6999
return true ;
7019
7000
7020
7001
// Lex the repeat definition.
@@ -7129,7 +7110,7 @@ bool MasmParser::parseDirectiveFor(SMLoc DirectiveLoc, StringRef Dir) {
7129
7110
if (parseToken (AsmToken::Greater,
7130
7111
" values in '" + Dir +
7131
7112
" ' directive must be enclosed in angle brackets" ) ||
7132
- parseToken (AsmToken::EndOfStatement, " expected End of Statement " ))
7113
+ parseEOL ( ))
7133
7114
return true ;
7134
7115
7135
7116
// Lex the for definition.
@@ -7179,7 +7160,7 @@ bool MasmParser::parseDirectiveForc(SMLoc DirectiveLoc, StringRef Directive) {
7179
7160
}
7180
7161
Argument.resize (End);
7181
7162
}
7182
- if (parseToken (AsmToken::EndOfStatement, " expected end of statement " ))
7163
+ if (parseEOL ( ))
7183
7164
return true ;
7184
7165
7185
7166
// Lex the irpc definition.
0 commit comments