aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2013-04-10 20:07:47 +0000
committerChad Rosier <mcrosier@apple.com>2013-04-10 20:07:47 +0000
commit37c04bcff28ae24aa84c44d73b1079bdab09c8c5 (patch)
tree2d86289831aebfac266bd0401d9dfcf97ea8e071 /lib
parentf0ca9a8c94dafe795d5141e862ded156d6c6cd66 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179210 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/AsmParser/X86AsmParser.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 224050656d..f587d36232 100644
--- a/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1127,7 +1127,8 @@ X86Operand *X86AsmParser::ParseIntelBracExpression(unsigned SegReg,
// 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::ParseIntelBracExpression(unsigned SegReg,
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::ParseIntelBracExpression(unsigned SegReg,
}
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::ParseIntelBracExpression(unsigned SegReg,
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::ParseIntelMemOperand(unsigned SegReg,
// 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::ParseIntelMemOperand(unsigned SegReg,
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::ParseIntelOperator(unsigned OpKind) {
}
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::ParseIntelOperand() {
// 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;
}