summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@codeaurora.org>2017-01-19 20:06:32 +0000
committerChad Rosier <mcrosier@codeaurora.org>2017-01-19 20:06:32 +0000
commit9245e12f95b6eee638d6ced013b91c5ee364e940 (patch)
tree0d418d901f59f286533d883110f11965aa905ddd /llvm/lib/MC/MCParser/AsmParser.cpp
parentf2d9a46b5ff059f002602c7d6199bda1993435dd (diff)
downloadbcm5719-llvm-9245e12f95b6eee638d6ced013b91c5ee364e940.tar.gz
bcm5719-llvm-9245e12f95b6eee638d6ced013b91c5ee364e940.zip
[Assembler] Improve error when unable to evaluate expression.
Add a SMLoc to MCExpr. Most code does not generate or consume the SMLoc (yet). Patch by Sanne Wouda <sanne.wouda@arm.com>! Differential Revision: https://reviews.llvm.org/D28861 llvm-svn: 292515
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index da54155b3b9..f8744f5542e 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -1005,7 +1005,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
}
// Otherwise create a symbol ref.
- Res = MCSymbolRefExpr::create(Sym, Variant, getContext());
+ Res = MCSymbolRefExpr::create(Sym, Variant, getContext(), FirstTokenLoc);
return false;
}
case AsmToken::BigNum:
@@ -1436,6 +1436,7 @@ unsigned AsmParser::getBinOpPrecedence(AsmToken::TokenKind K,
/// Res contains the LHS of the expression on input.
bool AsmParser::parseBinOpRHS(unsigned Precedence, const MCExpr *&Res,
SMLoc &EndLoc) {
+ SMLoc StartLoc = Lexer.getLoc();
while (true) {
MCBinaryExpr::Opcode Kind = MCBinaryExpr::Add;
unsigned TokPrec = getBinOpPrecedence(Lexer.getKind(), Kind);
@@ -1460,7 +1461,7 @@ bool AsmParser::parseBinOpRHS(unsigned Precedence, const MCExpr *&Res,
return true;
// Merge LHS and RHS according to operator.
- Res = MCBinaryExpr::create(Kind, Res, RHS, getContext());
+ Res = MCBinaryExpr::create(Kind, Res, RHS, getContext(), StartLoc);
}
}
OpenPOWER on IntegriCloud