@@ -2378,7 +2378,7 @@ bool X86AsmParser::ParseIntelDotOperator(IntelExprStateMachine &SM,
2378
2378
// Drop the optional '.'.
2379
2379
StringRef DotDispStr = Tok.getString ();
2380
2380
DotDispStr.consume_front (" ." );
2381
- StringRef TrailingDot;
2381
+ bool TrailingDot = false ;
2382
2382
2383
2383
// .Imm gets lexed as a real.
2384
2384
if (Tok.is (AsmToken::Real)) {
@@ -2388,10 +2388,7 @@ bool X86AsmParser::ParseIntelDotOperator(IntelExprStateMachine &SM,
2388
2388
Info.Offset = DotDisp.getZExtValue ();
2389
2389
} else if ((isParsingMSInlineAsm () || getParser ().isParsingMasm ()) &&
2390
2390
Tok.is (AsmToken::Identifier)) {
2391
- if (DotDispStr.ends_with (" ." )) {
2392
- TrailingDot = DotDispStr.substr (DotDispStr.size () - 1 );
2393
- DotDispStr = DotDispStr.drop_back (1 );
2394
- }
2391
+ TrailingDot = DotDispStr.consume_back (" ." );
2395
2392
const std::pair<StringRef, StringRef> BaseMember = DotDispStr.split (' .' );
2396
2393
const StringRef Base = BaseMember.first , Member = BaseMember.second ;
2397
2394
if (getParser ().lookUpField (SM.getType (), DotDispStr, Info) &&
@@ -2409,8 +2406,8 @@ bool X86AsmParser::ParseIntelDotOperator(IntelExprStateMachine &SM,
2409
2406
const char *DotExprEndLoc = DotDispStr.data () + DotDispStr.size ();
2410
2407
while (Tok.getLoc ().getPointer () < DotExprEndLoc)
2411
2408
Lex ();
2412
- if (! TrailingDot. empty () )
2413
- getLexer ().UnLex (AsmToken (AsmToken::Dot, TrailingDot ));
2409
+ if (TrailingDot)
2410
+ getLexer ().UnLex (AsmToken (AsmToken::Dot, " . " ));
2414
2411
SM.addImm (Info.Offset );
2415
2412
SM.setTypeInfo (Info.Type );
2416
2413
return false ;
0 commit comments