@@ -3616,13 +3616,7 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
36163616// / parseDirectiveLine
36173617// / ::= .line [number]
36183618bool 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);
36263620 return parseEOL ();
36273621}
36283622
@@ -3636,7 +3630,7 @@ bool AsmParser::parseDirectiveLine() {
36363630bool AsmParser::parseDirectiveLoc () {
36373631 int64_t FileNumber = 0 , LineNumber = 0 ;
36383632 SMLoc Loc = getTok ().getLoc ();
3639- if (parseIntToken (FileNumber, " unexpected token in '.loc' directive " ) ||
3633+ if (parseIntToken (FileNumber) ||
36403634 check (FileNumber < 1 && Ctx.getDwarfVersion () < 5 , Loc,
36413635 " file number less than one in '.loc' directive" ) ||
36423636 check (!getContext ().isValidDwarfFileNumber (FileNumber), Loc,
@@ -3753,8 +3747,7 @@ bool AsmParser::parseDirectiveCVFile() {
37533747 std::string Checksum;
37543748 int64_t ChecksumKind = 0 ;
37553749
3756- if (parseIntToken (FileNumber,
3757- " expected file number in '.cv_file' directive" ) ||
3750+ if (parseIntToken (FileNumber, " expected file number" ) ||
37583751 check (FileNumber < 1 , FileNumberLoc, " file number less than one" ) ||
37593752 check (getTok ().isNot (AsmToken::String),
37603753 " unexpected token in '.cv_file' directive" ) ||
@@ -3787,19 +3780,18 @@ bool AsmParser::parseCVFunctionId(int64_t &FunctionId,
37873780 StringRef DirectiveName) {
37883781 SMLoc Loc;
37893782 return parseTokenLoc (Loc) ||
3790- parseIntToken (FunctionId, " expected function id in '" + DirectiveName +
3791- " ' directive" ) ||
3783+ parseIntToken (FunctionId, " expected function id" ) ||
37923784 check (FunctionId < 0 || FunctionId >= UINT_MAX, Loc,
37933785 " expected function id within range [0, UINT_MAX)" );
37943786}
37953787
37963788bool AsmParser::parseCVFileId (int64_t &FileNumber, StringRef DirectiveName) {
37973789 SMLoc Loc;
37983790 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" ) ||
38033795 check (!getCVContext ().isValidFileNumber (FileNumber), Loc,
38043796 " unassigned file number in '" + DirectiveName + " ' directive" );
38053797}
@@ -3978,21 +3970,15 @@ bool AsmParser::parseDirectiveCVInlineLinetable() {
39783970 SMLoc Loc = getTok ().getLoc ();
39793971 if (parseCVFunctionId (PrimaryFunctionId, " .cv_inline_linetable" ) ||
39803972 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" ) ||
39863980 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" ))
39963982 return true ;
39973983
39983984 if (parseEOL ())
@@ -4154,7 +4140,7 @@ bool AsmParser::parseDirectiveCVFileChecksums() {
41544140// / ::= .cv_filechecksumoffset fileno
41554141bool AsmParser::parseDirectiveCVFileChecksumOffset () {
41564142 int64_t FileNo;
4157- if (parseIntToken (FileNo, " expected identifier in directive " ))
4143+ if (parseIntToken (FileNo))
41584144 return true ;
41594145 if (parseEOL ())
41604146 return true ;
@@ -5896,24 +5882,16 @@ bool AsmParser::parseDirectivePseudoProbe() {
58965882 int64_t Type;
58975883 int64_t Attr;
58985884 int64_t Discriminator = 0 ;
5899-
5900- if (parseIntToken (Guid, " unexpected token in '.pseudoprobe' directive" ))
5885+ if (parseIntToken (Guid))
59015886 return true ;
5902-
5903- if (parseIntToken (Index, " unexpected token in '.pseudoprobe' directive" ))
5887+ if (parseIntToken (Index))
59045888 return true ;
5905-
5906- if (parseIntToken (Type, " unexpected token in '.pseudoprobe' directive" ))
5889+ if (parseIntToken (Type))
59075890 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))
59105894 return true ;
5911-
5912- if (hasDiscriminator (Attr)) {
5913- if (parseIntToken (Discriminator,
5914- " unexpected token in '.pseudoprobe' directive" ))
5915- return true ;
5916- }
59175895
59185896 // Parse inline stack like @ GUID:11:12 @ GUID:1:11 @ GUID:3:21
59195897 MCPseudoProbeInlineStack InlineStack;
@@ -5924,9 +5902,8 @@ bool AsmParser::parseDirectivePseudoProbe() {
59245902
59255903 int64_t CallerGuid = 0 ;
59265904 if (getLexer ().is (AsmToken::Integer)) {
5927- if (parseIntToken (CallerGuid,
5928- " unexpected token in '.pseudoprobe' directive" ))
5929- return true ;
5905+ CallerGuid = getTok ().getIntVal ();
5906+ Lex ();
59305907 }
59315908
59325909 // eat colon
@@ -5935,9 +5912,8 @@ bool AsmParser::parseDirectivePseudoProbe() {
59355912
59365913 int64_t CallerProbeId = 0 ;
59375914 if (getLexer ().is (AsmToken::Integer)) {
5938- if (parseIntToken (CallerProbeId,
5939- " unexpected token in '.pseudoprobe' directive" ))
5940- return true ;
5915+ CallerProbeId = getTok ().getIntVal ();
5916+ Lex ();
59415917 }
59425918
59435919 InlineSite Site (CallerGuid, CallerProbeId);
@@ -5947,7 +5923,7 @@ bool AsmParser::parseDirectivePseudoProbe() {
59475923 // Parse function entry name
59485924 StringRef FnName;
59495925 if (parseIdentifier (FnName))
5950- return Error (getLexer ().getLoc (), " unexpected token in '.pseudoprobe' directive " );
5926+ return Error (getLexer ().getLoc (), " expected identifier " );
59515927 MCSymbol *FnSym = getContext ().lookupSymbol (FnName);
59525928
59535929 if (parseEOL ())
0 commit comments