mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-03 11:24:18 +00:00
AsmParser: cleanup diagnostics for .rep/.rept
Avoid double diagnostics for invalid expressions for count. Improve caret location for negative count. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198099 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -3958,12 +3958,19 @@ void AsmParser::instantiateMacroLikeBody(MCAsmMacro *M, SMLoc DirectiveLoc,
|
||||
/// parseDirectiveRept
|
||||
/// ::= .rep | .rept count
|
||||
bool AsmParser::parseDirectiveRept(SMLoc DirectiveLoc, StringRef Dir) {
|
||||
const MCExpr *CountExpr;
|
||||
SMLoc CountLoc = getTok().getLoc();
|
||||
if (parseExpression(CountExpr))
|
||||
return true;
|
||||
|
||||
int64_t Count;
|
||||
if (parseAbsoluteExpression(Count))
|
||||
return TokError("unexpected token in '" + Dir + "' directive");
|
||||
if (!CountExpr->EvaluateAsAbsolute(Count)) {
|
||||
eatToEndOfStatement();
|
||||
return Error(CountLoc, "unexpected token in '" + Dir + "' directive");
|
||||
}
|
||||
|
||||
if (Count < 0)
|
||||
return TokError("Count is negative");
|
||||
return Error(CountLoc, "Count is negative");
|
||||
|
||||
if (Lexer.isNot(AsmToken::EndOfStatement))
|
||||
return TokError("unexpected token in '" + Dir + "' directive");
|
||||
|
Reference in New Issue
Block a user