Blang/src/lib/Statement/BinaryOperatorExpr.cpp

53 lines
950 B
C++

#include "Statement/BinaryOperatorExpr.h"
static std::string BinaryOperatorExpr::getOpcodeStr(BinaryOperatorExpr::Opcode opc) const
{
switch (opc) {
#define BINARY_OPERATION(Name, Spelling) case BO_##Name: return Spelling;
#include "OperationKinds.def"
}
}
BinaryOperatorExpr::BinaryOperatorExpr(Expr *lhs, Expr *rhs, BinaryOperatorExpr::Opcode opc):
_opc(opc)
{
_subExprs[LHS]= lhs;
_subExprs[RHS]= rhs;
}
Expr *BinaryOperatorExpr::getLHS() const
{
}
void BinaryOperatorExpr::setLHS(Expr *E)
{
_subExprs[LHS] = E;
}
Expr *BinaryOperatorExpr::getRHS() const
{
return _subExprs[RHS];
}
void BinaryOperatorExpr::setRHS(Expr *E)
{
_subExprs[RHS] = E;
}
BinaryOperatorExpr::Opcode BinaryOperatorExpr::getOpcode() const
{
return _opc;
}
void BinaryOperatorExpr::setOpcode(BinaryOperatorExpr::Opcode O)
{
_opc = O;
}
std::string BinaryOperatorExpr::getOpcodeStr() const
{
return getOpcodeStr(_opc);
}