@@ -3616,13 +3616,7 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
3616
3616
// / parseDirectiveLine
3617
3617
// / ::= .line [number]
3618
3618
bool AsmParser::parseDirectiveLine () {
3619
- int64_t LineNumber;
3620
- if (getLexer ().is (AsmToken::Integer)) {
3621
- if (parseIntToken (LineNumber, " unexpected token in '.line' directive" ))
3622
- return true ;
3623
- (void )LineNumber;
3624
- // FIXME: Do something with the .line.
3625
- }
3619
+ parseOptionalToken (AsmToken::Integer);
3626
3620
return parseEOL ();
3627
3621
}
3628
3622
@@ -3636,7 +3630,7 @@ bool AsmParser::parseDirectiveLine() {
3636
3630
bool AsmParser::parseDirectiveLoc () {
3637
3631
int64_t FileNumber = 0 , LineNumber = 0 ;
3638
3632
SMLoc Loc = getTok ().getLoc ();
3639
- if (parseIntToken (FileNumber, " unexpected token in '.loc' directive " ) ||
3633
+ if (parseIntToken (FileNumber) ||
3640
3634
check (FileNumber < 1 && Ctx.getDwarfVersion () < 5 , Loc,
3641
3635
" file number less than one in '.loc' directive" ) ||
3642
3636
check (!getContext ().isValidDwarfFileNumber (FileNumber), Loc,
@@ -3753,8 +3747,7 @@ bool AsmParser::parseDirectiveCVFile() {
3753
3747
std::string Checksum;
3754
3748
int64_t ChecksumKind = 0 ;
3755
3749
3756
- if (parseIntToken (FileNumber,
3757
- " expected file number in '.cv_file' directive" ) ||
3750
+ if (parseIntToken (FileNumber, " expected file number" ) ||
3758
3751
check (FileNumber < 1 , FileNumberLoc, " file number less than one" ) ||
3759
3752
check (getTok ().isNot (AsmToken::String),
3760
3753
" unexpected token in '.cv_file' directive" ) ||
@@ -3787,19 +3780,18 @@ bool AsmParser::parseCVFunctionId(int64_t &FunctionId,
3787
3780
StringRef DirectiveName) {
3788
3781
SMLoc Loc;
3789
3782
return parseTokenLoc (Loc) ||
3790
- parseIntToken (FunctionId, " expected function id in '" + DirectiveName +
3791
- " ' directive" ) ||
3783
+ parseIntToken (FunctionId, " expected function id" ) ||
3792
3784
check (FunctionId < 0 || FunctionId >= UINT_MAX, Loc,
3793
3785
" expected function id within range [0, UINT_MAX)" );
3794
3786
}
3795
3787
3796
3788
bool AsmParser::parseCVFileId (int64_t &FileNumber, StringRef DirectiveName) {
3797
3789
SMLoc Loc;
3798
3790
return parseTokenLoc (Loc) ||
3799
- parseIntToken (FileNumber, " expected integer in ' " + DirectiveName +
3800
- " ' directive " ) ||
3801
- check (FileNumber < 1 , Loc, " file number less than one in '" +
3802
- DirectiveName + " ' directive" ) ||
3791
+ parseIntToken (FileNumber, " expected file number " ) ||
3792
+ check (FileNumber < 1 , Loc,
3793
+ " file number less than one in '" + DirectiveName +
3794
+ " ' directive" ) ||
3803
3795
check (!getCVContext ().isValidFileNumber (FileNumber), Loc,
3804
3796
" unassigned file number in '" + DirectiveName + " ' directive" );
3805
3797
}
@@ -3978,21 +3970,15 @@ bool AsmParser::parseDirectiveCVInlineLinetable() {
3978
3970
SMLoc Loc = getTok ().getLoc ();
3979
3971
if (parseCVFunctionId (PrimaryFunctionId, " .cv_inline_linetable" ) ||
3980
3972
parseTokenLoc (Loc) ||
3981
- parseIntToken (
3982
- SourceFileId,
3983
- " expected SourceField in '.cv_inline_linetable' directive" ) ||
3984
- check (SourceFileId <= 0 , Loc,
3985
- " File id less than zero in '.cv_inline_linetable' directive" ) ||
3973
+ parseIntToken (SourceFileId, " expected SourceField" ) ||
3974
+ check (SourceFileId <= 0 , Loc, " File id less than zero" ) ||
3975
+ parseTokenLoc (Loc) ||
3976
+ parseIntToken (SourceLineNum, " expected SourceLineNum" ) ||
3977
+ check (SourceLineNum < 0 , Loc, " Line number less than zero" ) ||
3978
+ parseTokenLoc (Loc) ||
3979
+ check (parseIdentifier (FnStartName), Loc, " expected identifier" ) ||
3986
3980
parseTokenLoc (Loc) ||
3987
- parseIntToken (
3988
- SourceLineNum,
3989
- " expected SourceLineNum in '.cv_inline_linetable' directive" ) ||
3990
- check (SourceLineNum < 0 , Loc,
3991
- " Line number less than zero in '.cv_inline_linetable' directive" ) ||
3992
- parseTokenLoc (Loc) || check (parseIdentifier (FnStartName), Loc,
3993
- " expected identifier in directive" ) ||
3994
- parseTokenLoc (Loc) || check (parseIdentifier (FnEndName), Loc,
3995
- " expected identifier in directive" ))
3981
+ check (parseIdentifier (FnEndName), Loc, " expected identifier" ))
3996
3982
return true ;
3997
3983
3998
3984
if (parseEOL ())
@@ -4154,7 +4140,7 @@ bool AsmParser::parseDirectiveCVFileChecksums() {
4154
4140
// / ::= .cv_filechecksumoffset fileno
4155
4141
bool AsmParser::parseDirectiveCVFileChecksumOffset () {
4156
4142
int64_t FileNo;
4157
- if (parseIntToken (FileNo, " expected identifier in directive " ))
4143
+ if (parseIntToken (FileNo))
4158
4144
return true ;
4159
4145
if (parseEOL ())
4160
4146
return true ;
@@ -5896,24 +5882,16 @@ bool AsmParser::parseDirectivePseudoProbe() {
5896
5882
int64_t Type;
5897
5883
int64_t Attr;
5898
5884
int64_t Discriminator = 0 ;
5899
-
5900
- if (parseIntToken (Guid, " unexpected token in '.pseudoprobe' directive" ))
5885
+ if (parseIntToken (Guid))
5901
5886
return true ;
5902
-
5903
- if (parseIntToken (Index, " unexpected token in '.pseudoprobe' directive" ))
5887
+ if (parseIntToken (Index))
5904
5888
return true ;
5905
-
5906
- if (parseIntToken (Type, " unexpected token in '.pseudoprobe' directive" ))
5889
+ if (parseIntToken (Type))
5907
5890
return true ;
5908
-
5909
- if (parseIntToken (Attr, " unexpected token in '.pseudoprobe' directive" ))
5891
+ if (parseIntToken (Attr))
5892
+ return true ;
5893
+ if (hasDiscriminator (Attr) && parseIntToken (Discriminator))
5910
5894
return true ;
5911
-
5912
- if (hasDiscriminator (Attr)) {
5913
- if (parseIntToken (Discriminator,
5914
- " unexpected token in '.pseudoprobe' directive" ))
5915
- return true ;
5916
- }
5917
5895
5918
5896
// Parse inline stack like @ GUID:11:12 @ GUID:1:11 @ GUID:3:21
5919
5897
MCPseudoProbeInlineStack InlineStack;
@@ -5924,9 +5902,8 @@ bool AsmParser::parseDirectivePseudoProbe() {
5924
5902
5925
5903
int64_t CallerGuid = 0 ;
5926
5904
if (getLexer ().is (AsmToken::Integer)) {
5927
- if (parseIntToken (CallerGuid,
5928
- " unexpected token in '.pseudoprobe' directive" ))
5929
- return true ;
5905
+ CallerGuid = getTok ().getIntVal ();
5906
+ Lex ();
5930
5907
}
5931
5908
5932
5909
// eat colon
@@ -5935,9 +5912,8 @@ bool AsmParser::parseDirectivePseudoProbe() {
5935
5912
5936
5913
int64_t CallerProbeId = 0 ;
5937
5914
if (getLexer ().is (AsmToken::Integer)) {
5938
- if (parseIntToken (CallerProbeId,
5939
- " unexpected token in '.pseudoprobe' directive" ))
5940
- return true ;
5915
+ CallerProbeId = getTok ().getIntVal ();
5916
+ Lex ();
5941
5917
}
5942
5918
5943
5919
InlineSite Site (CallerGuid, CallerProbeId);
@@ -5947,7 +5923,7 @@ bool AsmParser::parseDirectivePseudoProbe() {
5947
5923
// Parse function entry name
5948
5924
StringRef FnName;
5949
5925
if (parseIdentifier (FnName))
5950
- return Error (getLexer ().getLoc (), " unexpected token in '.pseudoprobe' directive " );
5926
+ return Error (getLexer ().getLoc (), " expected identifier " );
5951
5927
MCSymbol *FnSym = getContext ().lookupSymbol (FnName);
5952
5928
5953
5929
if (parseEOL ())
0 commit comments