Opcode Op;
const MCExpr *Expr;
- MCUnaryExpr(Opcode Op, const MCExpr *Expr)
- : MCExpr(MCExpr::Unary, SMLoc()), Op(Op), Expr(Expr) {}
+ MCUnaryExpr(Opcode Op, const MCExpr *Expr, SMLoc Loc)
+ : MCExpr(MCExpr::Unary, Loc), Op(Op), Expr(Expr) {}
public:
/// \name Construction
/// @{
static const MCUnaryExpr *create(Opcode Op, const MCExpr *Expr,
- MCContext &Ctx);
+ MCContext &Ctx, SMLoc Loc = SMLoc());
- static const MCUnaryExpr *createLNot(const MCExpr *Expr, MCContext &Ctx) {
- return create(LNot, Expr, Ctx);
+ static const MCUnaryExpr *createLNot(const MCExpr *Expr, MCContext &Ctx, SMLoc Loc = SMLoc()) {
+ return create(LNot, Expr, Ctx, Loc);
}
- static const MCUnaryExpr *createMinus(const MCExpr *Expr, MCContext &Ctx) {
- return create(Minus, Expr, Ctx);
+ static const MCUnaryExpr *createMinus(const MCExpr *Expr, MCContext &Ctx, SMLoc Loc = SMLoc()) {
+ return create(Minus, Expr, Ctx, Loc);
}
- static const MCUnaryExpr *createNot(const MCExpr *Expr, MCContext &Ctx) {
- return create(Not, Expr, Ctx);
+ static const MCUnaryExpr *createNot(const MCExpr *Expr, MCContext &Ctx, SMLoc Loc = SMLoc()) {
+ return create(Not, Expr, Ctx, Loc);
}
- static const MCUnaryExpr *createPlus(const MCExpr *Expr, MCContext &Ctx) {
- return create(Plus, Expr, Ctx);
+ static const MCUnaryExpr *createPlus(const MCExpr *Expr, MCContext &Ctx, SMLoc Loc = SMLoc()) {
+ return create(Plus, Expr, Ctx, Loc);
}
/// @}
}
const MCUnaryExpr *MCUnaryExpr::create(Opcode Opc, const MCExpr *Expr,
- MCContext &Ctx) {
- return new (Ctx) MCUnaryExpr(Opc, Expr);
+ MCContext &Ctx, SMLoc Loc) {
+ return new (Ctx) MCUnaryExpr(Opc, Expr, Loc);
}
const MCConstantExpr *MCConstantExpr::create(int64_t Value, MCContext &Ctx) {
Lex(); // Eat the operator.
if (parsePrimaryExpr(Res, EndLoc))
return true;
- Res = MCUnaryExpr::createLNot(Res, getContext());
+ Res = MCUnaryExpr::createLNot(Res, getContext(), FirstTokenLoc);
return false;
case AsmToken::Dollar:
case AsmToken::At:
Lex(); // Eat the operator.
if (parsePrimaryExpr(Res, EndLoc))
return true;
- Res = MCUnaryExpr::createMinus(Res, getContext());
+ Res = MCUnaryExpr::createMinus(Res, getContext(), FirstTokenLoc);
return false;
case AsmToken::Plus:
Lex(); // Eat the operator.
if (parsePrimaryExpr(Res, EndLoc))
return true;
- Res = MCUnaryExpr::createPlus(Res, getContext());
+ Res = MCUnaryExpr::createPlus(Res, getContext(), FirstTokenLoc);
return false;
case AsmToken::Tilde:
Lex(); // Eat the operator.
if (parsePrimaryExpr(Res, EndLoc))
return true;
- Res = MCUnaryExpr::createNot(Res, getContext());
+ Res = MCUnaryExpr::createNot(Res, getContext(), FirstTokenLoc);
return false;
// MIPS unary expression operators. The lexer won't generate these tokens if
// MCAsmInfo::HasMipsExpressions is false for the target.