namespace llvm {
class MCAsmLexer;
namespace llvm {
class MCAsmLexer;
class MCValue;
class SMLoc;
class Twine;
class MCValue;
class SMLoc;
class Twine;
virtual MCAsmLexer &getLexer() = 0;
virtual MCAsmLexer &getLexer() = 0;
+ virtual MCContext &getContext() = 0;
+
/// Warning - Emit a warning at the location \arg L, with the message \arg
/// Msg.
virtual void Warning(SMLoc L, const Twine &Msg) = 0;
/// Warning - Emit a warning at the location \arg L, with the message \arg
/// Msg.
virtual void Warning(SMLoc L, const Twine &Msg) = 0;
Lexer.Lex(); // Eat the operator.
if (ParsePrimaryExpr(Res))
return true;
Lexer.Lex(); // Eat the operator.
if (ParsePrimaryExpr(Res))
return true;
- Res = MCUnaryExpr::CreateLNot(Res, Ctx);
+ Res = MCUnaryExpr::CreateLNot(Res, getContext());
return false;
case AsmToken::String:
case AsmToken::Identifier: {
return false;
case AsmToken::String:
case AsmToken::Identifier: {
// handle things like LFOO+4.
MCSymbol *Sym = CreateSymbol(Lexer.getTok().getIdentifier());
// handle things like LFOO+4.
MCSymbol *Sym = CreateSymbol(Lexer.getTok().getIdentifier());
- Res = MCSymbolRefExpr::Create(Sym, Ctx);
+ Res = MCSymbolRefExpr::Create(Sym, getContext());
Lexer.Lex(); // Eat identifier.
return false;
}
case AsmToken::Integer:
Lexer.Lex(); // Eat identifier.
return false;
}
case AsmToken::Integer:
- Res = MCConstantExpr::Create(Lexer.getTok().getIntVal(), Ctx);
+ Res = MCConstantExpr::Create(Lexer.getTok().getIntVal(), getContext());
Lexer.Lex(); // Eat token.
return false;
case AsmToken::LParen:
Lexer.Lex(); // Eat token.
return false;
case AsmToken::LParen:
Lexer.Lex(); // Eat the operator.
if (ParsePrimaryExpr(Res))
return true;
Lexer.Lex(); // Eat the operator.
if (ParsePrimaryExpr(Res))
return true;
- Res = MCUnaryExpr::CreateMinus(Res, Ctx);
+ Res = MCUnaryExpr::CreateMinus(Res, getContext());
return false;
case AsmToken::Plus:
Lexer.Lex(); // Eat the operator.
if (ParsePrimaryExpr(Res))
return true;
return false;
case AsmToken::Plus:
Lexer.Lex(); // Eat the operator.
if (ParsePrimaryExpr(Res))
return true;
- Res = MCUnaryExpr::CreatePlus(Res, Ctx);
+ Res = MCUnaryExpr::CreatePlus(Res, getContext());
return false;
case AsmToken::Tilde:
Lexer.Lex(); // Eat the operator.
if (ParsePrimaryExpr(Res))
return true;
return false;
case AsmToken::Tilde:
Lexer.Lex(); // Eat the operator.
if (ParsePrimaryExpr(Res))
return true;
- Res = MCUnaryExpr::CreateNot(Res, Ctx);
+ Res = MCUnaryExpr::CreateNot(Res, getContext());
static unsigned getBinOpPrecedence(AsmToken::TokenKind K,
MCBinaryExpr::Opcode &Kind) {
switch (K) {
static unsigned getBinOpPrecedence(AsmToken::TokenKind K,
MCBinaryExpr::Opcode &Kind) {
switch (K) {
- default: return 0; // not a binop.
+ default:
+ return 0; // not a binop.
// Lowest Precedence: &&, ||
case AsmToken::AmpAmp:
// Lowest Precedence: &&, ||
case AsmToken::AmpAmp:
}
// Merge LHS and RHS according to operator.
}
// Merge LHS and RHS according to operator.
- Res = MCBinaryExpr::Create(Kind, Res, RHS, Ctx);
+ Res = MCBinaryExpr::Create(Kind, Res, RHS, getContext());
virtual MCAsmLexer &getLexer() { return Lexer; }
virtual MCAsmLexer &getLexer() { return Lexer; }
+ virtual MCContext &getContext() { return Ctx; }
+
virtual void Warning(SMLoc L, const Twine &Meg);
virtual bool Error(SMLoc L, const Twine &Msg);
virtual void Warning(SMLoc L, const Twine &Meg);
virtual bool Error(SMLoc L, const Twine &Msg);
virtual bool ParseRelocatableExpression(MCValue &Res);
virtual bool ParseRelocatableExpression(MCValue &Res);
+ virtual bool ParseParenRelocatableExpression(MCValue &Res);
+
bool ParseAssignment(const StringRef &Name, bool IsDotSet);
bool ParseAssignment(const StringRef &Name, bool IsDotSet);
- /// ParseParenRelocatableExpression - Parse an expression which must be
- /// relocatable, assuming that an initial '(' has already been consumed.
- ///
- /// @param Res - The relocatable expression value. The result is undefined on
- /// error.
- /// @result - False on success.
- ///
- /// @see ParseRelocatableExpression, ParseParenExpr.
- bool ParseParenRelocatableExpression(MCValue &Res);
-
bool ParsePrimaryExpr(const MCExpr *&Res);
bool ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res);
bool ParseParenExpr(const MCExpr *&Res);
bool ParsePrimaryExpr(const MCExpr *&Res);
bool ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res);
bool ParseParenExpr(const MCExpr *&Res);