[llvm] r179210 - Tidy up, fix and simplify a few of the SMLocs. Prior to r179109 the Start SMLoc
Chad Rosier
mcrosier at apple.com
Wed Apr 10 13:07:47 PDT 2013
Author: mcrosier
Date: Wed Apr 10 15:07:47 2013
New Revision: 179210
URL: http://llvm.org/viewvc/llvm-project?rev=179210&view=rev
Log:
Tidy up, fix and simplify a few of the SMLocs. Prior to r179109 the Start SMLoc
wasn't always the start of the operand. If there was a symbol reference, then
Start pointed to that token. It's very likely there are other places that need
to be updated.
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=179210&r1=179209&r2=179210&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Wed Apr 10 15:07:47 2013
@@ -1127,7 +1127,8 @@ X86Operand *X86AsmParser::ParseIntelBrac
// Try to handle '[' 'Symbol' ']'
if (getLexer().is(AsmToken::Identifier)) {
- if (ParseRegister(TmpReg, Start, End)) {
+ SMLoc Loc = Tok.getLoc();
+ if (ParseRegister(TmpReg, Loc, End)) {
const MCExpr *Disp;
SMLoc IdentStart = Tok.getLoc();
if (getParser().parseExpression(Disp, End))
@@ -1137,7 +1138,7 @@ X86Operand *X86AsmParser::ParseIntelBrac
return Err;
if (getLexer().isNot(AsmToken::RBrac))
- return ErrorOperand(Parser.getTok().getLoc(), "Expected ']' token!");
+ return ErrorOperand(Tok.getLoc(), "Expected ']' token!");
unsigned Len = Tok.getLoc().getPointer() - IdentStart.getPointer();
StringRef SymName(IdentStart.getPointer(), Len);
@@ -1178,7 +1179,8 @@ X86Operand *X86AsmParser::ParseIntelBrac
}
case AsmToken::Identifier: {
// This could be a register or a displacement expression.
- if(!ParseRegister(TmpReg, Start, End)) {
+ SMLoc Loc = Tok.getLoc();
+ if(!ParseRegister(TmpReg, Loc, End)) {
SM.onRegister(TmpReg);
UpdateLocLex = false;
break;
@@ -1220,7 +1222,7 @@ X86Operand *X86AsmParser::ParseIntelBrac
if (ParseIntelDotOperator(Disp, &NewDisp, Err))
return ErrorOperand(Tok.getLoc(), Err);
- End = Parser.getTok().getEndLoc();
+ End = Tok.getEndLoc();
Parser.Lex(); // Eat the field.
Disp = NewDisp;
}
@@ -1297,11 +1299,10 @@ X86Operand *X86AsmParser::ParseIntelMemO
// Parse ImmDisp [ BaseReg + Scale*IndexReg + Disp ].
if (getLexer().is(AsmToken::Integer)) {
- const AsmToken &IntTok = Parser.getTok();
if (isParsingInlineAsm())
InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_ImmPrefix,
- IntTok.getLoc()));
- uint64_t ImmDisp = IntTok.getIntVal();
+ Tok.getLoc()));
+ uint64_t ImmDisp = Tok.getIntVal();
Parser.Lex(); // Eat the integer.
if (getLexer().isNot(AsmToken::LBrac))
return ErrorOperand(Start, "Expected '[' token!");
@@ -1341,7 +1342,7 @@ X86Operand *X86AsmParser::ParseIntelMemO
bool X86AsmParser::ParseIntelDotOperator(const MCExpr *Disp,
const MCExpr **NewDisp,
SmallString<64> &Err) {
- AsmToken Tok = *&Parser.getTok();
+ const AsmToken &Tok = Parser.getTok();
uint64_t OrigDispVal, DotDispVal;
// FIXME: Handle non-constant expressions.
@@ -1468,8 +1469,9 @@ X86Operand *X86AsmParser::ParseIntelOper
}
X86Operand *X86AsmParser::ParseIntelOperand() {
- SMLoc Start = Parser.getTok().getLoc(), End;
- StringRef AsmTokStr = Parser.getTok().getString();
+ const AsmToken &Tok = Parser.getTok();
+ SMLoc Start = Tok.getLoc(), End;
+ StringRef AsmTokStr = Tok.getString();
// Offset, length, type and size operators.
if (isParsingInlineAsm()) {
@@ -1497,7 +1499,7 @@ X86Operand *X86AsmParser::ParseIntelOper
// Only positive immediates are valid.
if (!isInteger) {
- Error(Parser.getTok().getLoc(), "expected a positive immediate "
+ Error(Tok.getLoc(), "expected a positive immediate "
"displacement before bracketed expr.");
return 0;
}
More information about the llvm-commits
mailing list