mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-08 05:26:50 +00:00
Promoted the getTok() method to MCAsmParser so that
the two token accessor functions are declared consistently. Modified the clients of MCAsmParser to reflect this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93916 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1c8183df7f
commit
18b8323de7
@ -55,6 +55,9 @@ public:
|
||||
/// inclusion first.
|
||||
virtual const AsmToken &Lex() = 0;
|
||||
|
||||
/// getTok - Get the current AsmToken from the stream.
|
||||
const AsmToken &getTok();
|
||||
|
||||
/// ParseExpression - Parse an arbitrary expression.
|
||||
///
|
||||
/// @param Res - The value of the expression. The result is undefined
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCAsmParser.h"
|
||||
#include "llvm/MC/MCAsmLexer.h"
|
||||
#include "llvm/MC/MCParsedAsmOperand.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
using namespace llvm;
|
||||
@ -18,12 +19,15 @@ MCAsmParser::MCAsmParser() {
|
||||
MCAsmParser::~MCAsmParser() {
|
||||
}
|
||||
|
||||
const AsmToken &MCAsmParser::getTok() {
|
||||
return getLexer().getTok();
|
||||
}
|
||||
|
||||
bool MCAsmParser::ParseExpression(const MCExpr *&Res) {
|
||||
SMLoc L;
|
||||
return ParseExpression(Res, L);
|
||||
}
|
||||
|
||||
|
||||
/// getStartLoc - Get the location of the first token of this operand.
|
||||
SMLoc MCParsedAsmOperand::getStartLoc() const { return SMLoc(); }
|
||||
SMLoc MCParsedAsmOperand::getEndLoc() const { return SMLoc(); }
|
||||
|
@ -222,7 +222,7 @@ struct ARMOperand : public MCParsedAsmOperand {
|
||||
/// TODO this is likely to change to allow different register types and or to
|
||||
/// parse for a specific register type.
|
||||
bool ARMAsmParser::MaybeParseRegister(ARMOperand &Op, bool ParseWriteBack) {
|
||||
const AsmToken &Tok = getLexer().getTok();
|
||||
const AsmToken &Tok = Parser.getTok();
|
||||
assert(Tok.is(AsmToken::Identifier) && "Token is not an Identifier");
|
||||
|
||||
// FIXME: Validate register for the current architecture; we have to do
|
||||
@ -236,7 +236,7 @@ bool ARMAsmParser::MaybeParseRegister(ARMOperand &Op, bool ParseWriteBack) {
|
||||
|
||||
bool Writeback = false;
|
||||
if (ParseWriteBack) {
|
||||
const AsmToken &ExclaimTok = getLexer().getTok();
|
||||
const AsmToken &ExclaimTok = Parser.getTok();
|
||||
if (ExclaimTok.is(AsmToken::Exclaim)) {
|
||||
Writeback = true;
|
||||
Parser.Lex(); // Eat exclaim token
|
||||
@ -251,11 +251,11 @@ bool ARMAsmParser::MaybeParseRegister(ARMOperand &Op, bool ParseWriteBack) {
|
||||
/// Parse a register list, return false if successful else return true or an
|
||||
/// error. The first token must be a '{' when called.
|
||||
bool ARMAsmParser::ParseRegisterList(ARMOperand &Op) {
|
||||
assert(getLexer().getTok().is(AsmToken::LCurly) &&
|
||||
assert(Parser.getTok().is(AsmToken::LCurly) &&
|
||||
"Token is not an Left Curly Brace");
|
||||
Parser.Lex(); // Eat left curly brace token.
|
||||
|
||||
const AsmToken &RegTok = getLexer().getTok();
|
||||
const AsmToken &RegTok = Parser.getTok();
|
||||
SMLoc RegLoc = RegTok.getLoc();
|
||||
if (RegTok.isNot(AsmToken::Identifier))
|
||||
return Error(RegLoc, "register expected");
|
||||
@ -267,10 +267,10 @@ bool ARMAsmParser::ParseRegisterList(ARMOperand &Op) {
|
||||
|
||||
int HighRegNum = RegNum;
|
||||
// TODO ranges like "{Rn-Rm}"
|
||||
while (getLexer().getTok().is(AsmToken::Comma)) {
|
||||
while (Parser.getTok().is(AsmToken::Comma)) {
|
||||
Parser.Lex(); // Eat comma token.
|
||||
|
||||
const AsmToken &RegTok = getLexer().getTok();
|
||||
const AsmToken &RegTok = Parser.getTok();
|
||||
SMLoc RegLoc = RegTok.getLoc();
|
||||
if (RegTok.isNot(AsmToken::Identifier))
|
||||
return Error(RegLoc, "register expected");
|
||||
@ -287,7 +287,7 @@ bool ARMAsmParser::ParseRegisterList(ARMOperand &Op) {
|
||||
|
||||
Parser.Lex(); // Eat identifier token.
|
||||
}
|
||||
const AsmToken &RCurlyTok = getLexer().getTok();
|
||||
const AsmToken &RCurlyTok = Parser.getTok();
|
||||
if (RCurlyTok.isNot(AsmToken::RCurly))
|
||||
return Error(RCurlyTok.getLoc(), "'}' expected");
|
||||
Parser.Lex(); // Eat left curly brace token.
|
||||
@ -300,11 +300,11 @@ bool ARMAsmParser::ParseRegisterList(ARMOperand &Op) {
|
||||
/// TODO Only preindexing and postindexing addressing are started, unindexed
|
||||
/// with option, etc are still to do.
|
||||
bool ARMAsmParser::ParseMemory(ARMOperand &Op) {
|
||||
assert(getLexer().getTok().is(AsmToken::LBrac) &&
|
||||
assert(Parser.getTok().is(AsmToken::LBrac) &&
|
||||
"Token is not an Left Bracket");
|
||||
Parser.Lex(); // Eat left bracket token.
|
||||
|
||||
const AsmToken &BaseRegTok = getLexer().getTok();
|
||||
const AsmToken &BaseRegTok = Parser.getTok();
|
||||
if (BaseRegTok.isNot(AsmToken::Identifier))
|
||||
return Error(BaseRegTok.getLoc(), "register expected");
|
||||
if (MaybeParseRegister(Op, false))
|
||||
@ -319,7 +319,7 @@ bool ARMAsmParser::ParseMemory(ARMOperand &Op) {
|
||||
|
||||
// First look for preindexed address forms, that is after the "[Rn" we now
|
||||
// have to see if the next token is a comma.
|
||||
const AsmToken &Tok = getLexer().getTok();
|
||||
const AsmToken &Tok = Parser.getTok();
|
||||
if (Tok.is(AsmToken::Comma)) {
|
||||
Preindexed = true;
|
||||
Parser.Lex(); // Eat comma token.
|
||||
@ -331,12 +331,12 @@ bool ARMAsmParser::ParseMemory(ARMOperand &Op) {
|
||||
if(ParseMemoryOffsetReg(Negative, OffsetRegShifted, ShiftType, ShiftAmount,
|
||||
Offset, OffsetIsReg, OffsetRegNum))
|
||||
return true;
|
||||
const AsmToken &RBracTok = getLexer().getTok();
|
||||
const AsmToken &RBracTok = Parser.getTok();
|
||||
if (RBracTok.isNot(AsmToken::RBrac))
|
||||
return Error(RBracTok.getLoc(), "']' expected");
|
||||
Parser.Lex(); // Eat right bracket token.
|
||||
|
||||
const AsmToken &ExclaimTok = getLexer().getTok();
|
||||
const AsmToken &ExclaimTok = Parser.getTok();
|
||||
if (ExclaimTok.is(AsmToken::Exclaim)) {
|
||||
Writeback = true;
|
||||
Parser.Lex(); // Eat exclaim token
|
||||
@ -360,7 +360,7 @@ bool ARMAsmParser::ParseMemory(ARMOperand &Op) {
|
||||
const MCExpr *ShiftAmount;
|
||||
const MCExpr *Offset;
|
||||
|
||||
const AsmToken &NextTok = getLexer().getTok();
|
||||
const AsmToken &NextTok = Parser.getTok();
|
||||
if (NextTok.isNot(AsmToken::EndOfStatement)) {
|
||||
if (NextTok.isNot(AsmToken::Comma))
|
||||
return Error(NextTok.getLoc(), "',' expected");
|
||||
@ -398,7 +398,7 @@ bool ARMAsmParser::ParseMemoryOffsetReg(bool &Negative,
|
||||
OffsetRegShifted = false;
|
||||
OffsetIsReg = false;
|
||||
OffsetRegNum = -1;
|
||||
const AsmToken &NextTok = getLexer().getTok();
|
||||
const AsmToken &NextTok = Parser.getTok();
|
||||
if (NextTok.is(AsmToken::Plus))
|
||||
Parser.Lex(); // Eat plus token.
|
||||
else if (NextTok.is(AsmToken::Minus)) {
|
||||
@ -406,7 +406,7 @@ bool ARMAsmParser::ParseMemoryOffsetReg(bool &Negative,
|
||||
Parser.Lex(); // Eat minus token
|
||||
}
|
||||
// See if there is a register following the "[Rn," or "[Rn]," we have so far.
|
||||
const AsmToken &OffsetRegTok = getLexer().getTok();
|
||||
const AsmToken &OffsetRegTok = Parser.getTok();
|
||||
if (OffsetRegTok.is(AsmToken::Identifier)) {
|
||||
OffsetIsReg = !MaybeParseRegister(Op, false);
|
||||
if (OffsetIsReg)
|
||||
@ -415,11 +415,11 @@ bool ARMAsmParser::ParseMemoryOffsetReg(bool &Negative,
|
||||
// If we parsed a register as the offset then their can be a shift after that
|
||||
if (OffsetRegNum != -1) {
|
||||
// Look for a comma then a shift
|
||||
const AsmToken &Tok = getLexer().getTok();
|
||||
const AsmToken &Tok = Parser.getTok();
|
||||
if (Tok.is(AsmToken::Comma)) {
|
||||
Parser.Lex(); // Eat comma token.
|
||||
|
||||
const AsmToken &Tok = getLexer().getTok();
|
||||
const AsmToken &Tok = Parser.getTok();
|
||||
if (ParseShift(ShiftType, ShiftAmount))
|
||||
return Error(Tok.getLoc(), "shift expected");
|
||||
OffsetRegShifted = true;
|
||||
@ -427,7 +427,7 @@ bool ARMAsmParser::ParseMemoryOffsetReg(bool &Negative,
|
||||
}
|
||||
else { // the "[Rn," or "[Rn,]" we have so far was not followed by "Rm"
|
||||
// Look for #offset following the "[Rn," or "[Rn],"
|
||||
const AsmToken &HashTok = getLexer().getTok();
|
||||
const AsmToken &HashTok = Parser.getTok();
|
||||
if (HashTok.isNot(AsmToken::Hash))
|
||||
return Error(HashTok.getLoc(), "'#' expected");
|
||||
Parser.Lex(); // Eat hash token.
|
||||
@ -443,7 +443,7 @@ bool ARMAsmParser::ParseMemoryOffsetReg(bool &Negative,
|
||||
/// rrx
|
||||
/// and returns true if it parses a shift otherwise it returns false.
|
||||
bool ARMAsmParser::ParseShift(ShiftType &St, const MCExpr *&ShiftAmount) {
|
||||
const AsmToken &Tok = getLexer().getTok();
|
||||
const AsmToken &Tok = Parser.getTok();
|
||||
if (Tok.isNot(AsmToken::Identifier))
|
||||
return true;
|
||||
const StringRef &ShiftName = Tok.getString();
|
||||
@ -466,7 +466,7 @@ bool ARMAsmParser::ParseShift(ShiftType &St, const MCExpr *&ShiftAmount) {
|
||||
return false;
|
||||
|
||||
// Otherwise, there must be a '#' and a shift amount.
|
||||
const AsmToken &HashTok = getLexer().getTok();
|
||||
const AsmToken &HashTok = Parser.getTok();
|
||||
if (HashTok.isNot(AsmToken::Hash))
|
||||
return Error(HashTok.getLoc(), "'#' expected");
|
||||
Parser.Lex(); // Eat hash token.
|
||||
@ -576,7 +576,7 @@ bool ARMAsmParser::ParseOperand(ARMOperand &Op) {
|
||||
Op = ARMOperand::CreateImm(ImmVal);
|
||||
return false;
|
||||
default:
|
||||
return Error(getLexer().getTok().getLoc(), "unexpected token in operand");
|
||||
return Error(Parser.getTok().getLoc(), "unexpected token in operand");
|
||||
}
|
||||
}
|
||||
|
||||
@ -585,7 +585,7 @@ bool ARMAsmParser::ParseInstruction(const StringRef &Name, SMLoc NameLoc,
|
||||
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||
Operands.push_back(new ARMOperand(ARMOperand::CreateToken(Name)));
|
||||
|
||||
SMLoc Loc = getLexer().getTok().getLoc();
|
||||
SMLoc Loc = Parser.getTok().getLoc();
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||
|
||||
// Read the first operand.
|
||||
@ -661,10 +661,10 @@ bool ARMAsmParser::ParseDirectiveThumb(SMLoc L) {
|
||||
/// ParseDirectiveThumbFunc
|
||||
/// ::= .thumbfunc symbol_name
|
||||
bool ARMAsmParser::ParseDirectiveThumbFunc(SMLoc L) {
|
||||
const AsmToken &Tok = getLexer().getTok();
|
||||
const AsmToken &Tok = Parser.getTok();
|
||||
if (Tok.isNot(AsmToken::Identifier) && Tok.isNot(AsmToken::String))
|
||||
return Error(L, "unexpected token in .syntax directive");
|
||||
StringRef ATTRIBUTE_UNUSED SymbolName = getLexer().getTok().getIdentifier();
|
||||
StringRef ATTRIBUTE_UNUSED SymbolName = Parser.getTok().getIdentifier();
|
||||
Parser.Lex(); // Consume the identifier token.
|
||||
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement))
|
||||
@ -679,7 +679,7 @@ bool ARMAsmParser::ParseDirectiveThumbFunc(SMLoc L) {
|
||||
/// ParseDirectiveSyntax
|
||||
/// ::= .syntax unified | divided
|
||||
bool ARMAsmParser::ParseDirectiveSyntax(SMLoc L) {
|
||||
const AsmToken &Tok = getLexer().getTok();
|
||||
const AsmToken &Tok = Parser.getTok();
|
||||
if (Tok.isNot(AsmToken::Identifier))
|
||||
return Error(L, "unexpected token in .syntax directive");
|
||||
const StringRef &Mode = Tok.getString();
|
||||
@ -696,7 +696,7 @@ bool ARMAsmParser::ParseDirectiveSyntax(SMLoc L) {
|
||||
return Error(L, "unrecognized syntax mode in .syntax directive");
|
||||
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement))
|
||||
return Error(getLexer().getTok().getLoc(), "unexpected token in directive");
|
||||
return Error(Parser.getTok().getLoc(), "unexpected token in directive");
|
||||
Parser.Lex();
|
||||
|
||||
// TODO tell the MC streamer the mode
|
||||
@ -707,10 +707,10 @@ bool ARMAsmParser::ParseDirectiveSyntax(SMLoc L) {
|
||||
/// ParseDirectiveCode
|
||||
/// ::= .code 16 | 32
|
||||
bool ARMAsmParser::ParseDirectiveCode(SMLoc L) {
|
||||
const AsmToken &Tok = getLexer().getTok();
|
||||
const AsmToken &Tok = Parser.getTok();
|
||||
if (Tok.isNot(AsmToken::Integer))
|
||||
return Error(L, "unexpected token in .code directive");
|
||||
int64_t Val = getLexer().getTok().getIntVal();
|
||||
int64_t Val = Parser.getTok().getIntVal();
|
||||
bool thumb_mode;
|
||||
if (Val == 16) {
|
||||
Parser.Lex();
|
||||
@ -724,7 +724,7 @@ bool ARMAsmParser::ParseDirectiveCode(SMLoc L) {
|
||||
return Error(L, "invalid operand to .code directive");
|
||||
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement))
|
||||
return Error(getLexer().getTok().getLoc(), "unexpected token in directive");
|
||||
return Error(Parser.getTok().getLoc(), "unexpected token in directive");
|
||||
Parser.Lex();
|
||||
|
||||
// TODO tell the MC streamer the mode
|
||||
|
@ -245,12 +245,12 @@ struct X86Operand : public MCParsedAsmOperand {
|
||||
bool X86ATTAsmParser::ParseRegister(unsigned &RegNo,
|
||||
SMLoc &StartLoc, SMLoc &EndLoc) {
|
||||
RegNo = 0;
|
||||
const AsmToken &TokPercent = getLexer().getTok();
|
||||
const AsmToken &TokPercent = Parser.getTok();
|
||||
assert(TokPercent.is(AsmToken::Percent) && "Invalid token kind!");
|
||||
StartLoc = TokPercent.getLoc();
|
||||
Parser.Lex(); // Eat percent token.
|
||||
|
||||
const AsmToken &Tok = getLexer().getTok();
|
||||
const AsmToken &Tok = Parser.getTok();
|
||||
if (Tok.isNot(AsmToken::Identifier))
|
||||
return Error(Tok.getLoc(), "invalid register name");
|
||||
|
||||
@ -279,7 +279,7 @@ X86Operand *X86ATTAsmParser::ParseOperand() {
|
||||
}
|
||||
case AsmToken::Dollar: {
|
||||
// $42 -> immediate.
|
||||
SMLoc Start = getLexer().getTok().getLoc(), End;
|
||||
SMLoc Start = Parser.getTok().getLoc(), End;
|
||||
Parser.Lex();
|
||||
const MCExpr *Val;
|
||||
if (getParser().ParseExpression(Val, End))
|
||||
@ -291,7 +291,7 @@ X86Operand *X86ATTAsmParser::ParseOperand() {
|
||||
|
||||
/// ParseMemOperand: segment: disp(basereg, indexreg, scale)
|
||||
X86Operand *X86ATTAsmParser::ParseMemOperand() {
|
||||
SMLoc MemStart = getLexer().getTok().getLoc();
|
||||
SMLoc MemStart = Parser.getTok().getLoc();
|
||||
|
||||
// FIXME: If SegReg ':' (e.g. %gs:), eat and remember.
|
||||
unsigned SegReg = 0;
|
||||
@ -319,7 +319,7 @@ X86Operand *X86ATTAsmParser::ParseMemOperand() {
|
||||
} else {
|
||||
// Okay, we have a '('. We don't know if this is an expression or not, but
|
||||
// so we have to eat the ( to see beyond it.
|
||||
SMLoc LParenLoc = getLexer().getTok().getLoc();
|
||||
SMLoc LParenLoc = Parser.getTok().getLoc();
|
||||
Parser.Lex(); // Eat the '('.
|
||||
|
||||
if (getLexer().is(AsmToken::Percent) || getLexer().is(AsmToken::Comma)) {
|
||||
@ -372,14 +372,14 @@ X86Operand *X86ATTAsmParser::ParseMemOperand() {
|
||||
// Parse the scale amount:
|
||||
// ::= ',' [scale-expression]
|
||||
if (getLexer().isNot(AsmToken::Comma)) {
|
||||
Error(getLexer().getTok().getLoc(),
|
||||
Error(Parser.getTok().getLoc(),
|
||||
"expected comma in scale expression");
|
||||
return 0;
|
||||
}
|
||||
Parser.Lex(); // Eat the comma.
|
||||
|
||||
if (getLexer().isNot(AsmToken::RParen)) {
|
||||
SMLoc Loc = getLexer().getTok().getLoc();
|
||||
SMLoc Loc = Parser.getTok().getLoc();
|
||||
|
||||
int64_t ScaleVal;
|
||||
if (getParser().ParseAbsoluteExpression(ScaleVal))
|
||||
@ -396,7 +396,7 @@ X86Operand *X86ATTAsmParser::ParseMemOperand() {
|
||||
} else if (getLexer().isNot(AsmToken::RParen)) {
|
||||
// Otherwise we have the unsupported form of a scale amount without an
|
||||
// index.
|
||||
SMLoc Loc = getLexer().getTok().getLoc();
|
||||
SMLoc Loc = Parser.getTok().getLoc();
|
||||
|
||||
int64_t Value;
|
||||
if (getParser().ParseAbsoluteExpression(Value))
|
||||
@ -409,10 +409,10 @@ X86Operand *X86ATTAsmParser::ParseMemOperand() {
|
||||
|
||||
// Ok, we've eaten the memory operand, verify we have a ')' and eat it too.
|
||||
if (getLexer().isNot(AsmToken::RParen)) {
|
||||
Error(getLexer().getTok().getLoc(), "unexpected token in memory operand");
|
||||
Error(Parser.getTok().getLoc(), "unexpected token in memory operand");
|
||||
return 0;
|
||||
}
|
||||
SMLoc MemEnd = getLexer().getTok().getLoc();
|
||||
SMLoc MemEnd = Parser.getTok().getLoc();
|
||||
Parser.Lex(); // Eat the ')'.
|
||||
|
||||
return X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale,
|
||||
@ -429,7 +429,7 @@ ParseInstruction(const StringRef &Name, SMLoc NameLoc,
|
||||
|
||||
// Parse '*' modifier.
|
||||
if (getLexer().is(AsmToken::Star)) {
|
||||
SMLoc Loc = getLexer().getTok().getLoc();
|
||||
SMLoc Loc = Parser.getTok().getLoc();
|
||||
Operands.push_back(X86Operand::CreateToken("*", Loc));
|
||||
Parser.Lex(); // Eat the star.
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ bool AsmParser::Run() {
|
||||
// Handle conditional assembly here before calling ParseStatement()
|
||||
if (Lexer.getKind() == AsmToken::Identifier) {
|
||||
// If we have an identifier, handle it as the key symbol.
|
||||
AsmToken ID = Lexer.getTok();
|
||||
AsmToken ID = getTok();
|
||||
SMLoc IDLoc = ID.getLoc();
|
||||
StringRef IDVal = ID.getString();
|
||||
|
||||
@ -233,7 +233,7 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
case AsmToken::String:
|
||||
case AsmToken::Identifier: {
|
||||
// This is a symbol reference.
|
||||
MCSymbol *Sym = CreateSymbol(Lexer.getTok().getIdentifier());
|
||||
MCSymbol *Sym = CreateSymbol(getTok().getIdentifier());
|
||||
EndLoc = Lexer.getLoc();
|
||||
Lex(); // Eat identifier.
|
||||
|
||||
@ -249,7 +249,7 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
return false;
|
||||
}
|
||||
case AsmToken::Integer:
|
||||
Res = MCConstantExpr::Create(Lexer.getTok().getIntVal(), getContext());
|
||||
Res = MCConstantExpr::Create(getTok().getIntVal(), getContext());
|
||||
EndLoc = Lexer.getLoc();
|
||||
Lex(); // Eat token.
|
||||
return false;
|
||||
@ -435,7 +435,7 @@ bool AsmParser::ParseStatement() {
|
||||
}
|
||||
|
||||
// Statements always start with an identifier.
|
||||
AsmToken ID = Lexer.getTok();
|
||||
AsmToken ID = getTok();
|
||||
SMLoc IDLoc = ID.getLoc();
|
||||
StringRef IDVal;
|
||||
if (ParseIdentifier(IDVal))
|
||||
@ -811,7 +811,7 @@ bool AsmParser::ParseIdentifier(StringRef &Res) {
|
||||
Lexer.isNot(AsmToken::String))
|
||||
return true;
|
||||
|
||||
Res = Lexer.getTok().getIdentifier();
|
||||
Res = getTok().getIdentifier();
|
||||
|
||||
Lex(); // Consume the identifier token.
|
||||
|
||||
@ -908,7 +908,7 @@ bool AsmParser::ParseEscapedString(std::string &Data) {
|
||||
assert(Lexer.is(AsmToken::String) && "Unexpected current token!");
|
||||
|
||||
Data = "";
|
||||
StringRef Str = Lexer.getTok().getStringContents();
|
||||
StringRef Str = getTok().getStringContents();
|
||||
for (unsigned i = 0, e = Str.size(); i != e; ++i) {
|
||||
if (Str[i] != '\\') {
|
||||
Data += Str[i];
|
||||
@ -1337,7 +1337,7 @@ bool AsmParser::ParseDirectiveDarwinZerofill() {
|
||||
|
||||
if (Lexer.isNot(AsmToken::Identifier))
|
||||
return TokError("expected segment name after '.zerofill' directive");
|
||||
StringRef Segment = Lexer.getTok().getString();
|
||||
StringRef Segment = getTok().getString();
|
||||
Lex();
|
||||
|
||||
if (Lexer.isNot(AsmToken::Comma))
|
||||
@ -1347,7 +1347,7 @@ bool AsmParser::ParseDirectiveDarwinZerofill() {
|
||||
if (Lexer.isNot(AsmToken::Identifier))
|
||||
return TokError("expected section name after comma in '.zerofill' "
|
||||
"directive");
|
||||
StringRef Section = Lexer.getTok().getString();
|
||||
StringRef Section = getTok().getString();
|
||||
Lex();
|
||||
|
||||
// If this is the end of the line all that was wanted was to create the
|
||||
@ -1369,7 +1369,7 @@ bool AsmParser::ParseDirectiveDarwinZerofill() {
|
||||
|
||||
// handle the identifier as the key symbol.
|
||||
SMLoc IDLoc = Lexer.getLoc();
|
||||
MCSymbol *Sym = CreateSymbol(Lexer.getTok().getString());
|
||||
MCSymbol *Sym = CreateSymbol(getTok().getString());
|
||||
Lex();
|
||||
|
||||
if (Lexer.isNot(AsmToken::Comma))
|
||||
@ -1444,7 +1444,7 @@ bool AsmParser::ParseDirectiveAbort() {
|
||||
if (Lexer.isNot(AsmToken::String))
|
||||
return TokError("expected string in '.abort' directive");
|
||||
|
||||
Str = Lexer.getTok().getString();
|
||||
Str = getTok().getString();
|
||||
|
||||
Lex();
|
||||
}
|
||||
@ -1500,7 +1500,7 @@ bool AsmParser::ParseDirectiveInclude() {
|
||||
if (Lexer.isNot(AsmToken::String))
|
||||
return TokError("expected string in '.include' directive");
|
||||
|
||||
std::string Filename = Lexer.getTok().getString();
|
||||
std::string Filename = getTok().getString();
|
||||
SMLoc IncludeLoc = Lexer.getLoc();
|
||||
Lex();
|
||||
|
||||
@ -1664,7 +1664,7 @@ bool AsmParser::ParseDirectiveFile(StringRef, SMLoc DirectiveLoc) {
|
||||
// FIXME: I'm not sure what this is.
|
||||
int64_t FileNumber = -1;
|
||||
if (Lexer.is(AsmToken::Integer)) {
|
||||
FileNumber = Lexer.getTok().getIntVal();
|
||||
FileNumber = getTok().getIntVal();
|
||||
Lex();
|
||||
|
||||
if (FileNumber < 1)
|
||||
@ -1674,7 +1674,7 @@ bool AsmParser::ParseDirectiveFile(StringRef, SMLoc DirectiveLoc) {
|
||||
if (Lexer.isNot(AsmToken::String))
|
||||
return TokError("unexpected token in '.file' directive");
|
||||
|
||||
StringRef ATTRIBUTE_UNUSED FileName = Lexer.getTok().getString();
|
||||
StringRef ATTRIBUTE_UNUSED FileName = getTok().getString();
|
||||
Lex();
|
||||
|
||||
if (Lexer.isNot(AsmToken::EndOfStatement))
|
||||
@ -1692,7 +1692,7 @@ bool AsmParser::ParseDirectiveLine(StringRef, SMLoc DirectiveLoc) {
|
||||
if (Lexer.isNot(AsmToken::Integer))
|
||||
return TokError("unexpected token in '.line' directive");
|
||||
|
||||
int64_t LineNumber = Lexer.getTok().getIntVal();
|
||||
int64_t LineNumber = getTok().getIntVal();
|
||||
(void) LineNumber;
|
||||
Lex();
|
||||
|
||||
@ -1713,7 +1713,7 @@ bool AsmParser::ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc) {
|
||||
return TokError("unexpected token in '.loc' directive");
|
||||
|
||||
// FIXME: What are these fields?
|
||||
int64_t FileNumber = Lexer.getTok().getIntVal();
|
||||
int64_t FileNumber = getTok().getIntVal();
|
||||
(void) FileNumber;
|
||||
// FIXME: Validate file.
|
||||
|
||||
@ -1722,7 +1722,7 @@ bool AsmParser::ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc) {
|
||||
if (Lexer.isNot(AsmToken::Integer))
|
||||
return TokError("unexpected token in '.loc' directive");
|
||||
|
||||
int64_t Param2 = Lexer.getTok().getIntVal();
|
||||
int64_t Param2 = getTok().getIntVal();
|
||||
(void) Param2;
|
||||
Lex();
|
||||
|
||||
@ -1730,7 +1730,7 @@ bool AsmParser::ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc) {
|
||||
if (Lexer.isNot(AsmToken::Integer))
|
||||
return TokError("unexpected token in '.loc' directive");
|
||||
|
||||
int64_t Param3 = Lexer.getTok().getIntVal();
|
||||
int64_t Param3 = getTok().getIntVal();
|
||||
(void) Param3;
|
||||
Lex();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user