Permalink
Browse files

Remove unnecessary class BoolExp

  • Loading branch information...
yebblies committed Dec 21, 2013
1 parent ada0354 commit eb1158e0daf6099efbad37e89d5d9f512cab6401
Showing with 2 additions and 69 deletions.
  1. +0 −6 src/e2ir.c
  2. +0 −27 src/expression.c
  3. +0 −10 src/expression.h
  4. +0 −6 src/gluestub.c
  5. +2 −20 src/optimize.c
View
@@ -3754,12 +3754,6 @@ elem *PtrExp::toElem(IRState *irs)
return e;
}
elem *BoolExp::toElem(IRState *irs)
{
elem *e1 = this->e1->toElem(irs);
return el_una(OPbool,type->totym(),e1);
}
elem *DeleteExp::toElem(IRState *irs)
{ elem *e;
int rtl;
View
@@ -9627,33 +9627,6 @@ int NotExp::isBit()
/************************************************************/
BoolExp::BoolExp(Loc loc, Expression *e, Type *t)
: UnaExp(loc, TOKtobool, sizeof(BoolExp), e)
{
type = t;
}
Expression *BoolExp::semantic(Scope *sc)
{
if (!type)
{ // Note there is no operator overload
UnaExp::semantic(sc);
e1 = resolveProperties(sc, e1);
e1 = e1->checkToBoolean(sc);
if (e1->type == Type::terror)
return e1;
type = Type::tboolean;
}
return this;
}
int BoolExp::isBit()
{
return true;
}
/************************************************************/
DeleteExp::DeleteExp(Loc loc, Expression *e)
View
@@ -1173,16 +1173,6 @@ class NotExp : public UnaExp
elem *toElem(IRState *irs);
};
class BoolExp : public UnaExp
{
public:
BoolExp(Loc loc, Expression *e, Type *type);
Expression *semantic(Scope *sc);
Expression *optimize(int result, bool keepLvalue = false);
int isBit();
elem *toElem(IRState *irs);
};
class DeleteExp : public UnaExp
{
public:
View
@@ -889,12 +889,6 @@ elem *PtrExp::toElem(IRState *irs)
return NULL;
}
elem *BoolExp::toElem(IRState *irs)
{
assert(0);
return NULL;
}
elem *DeleteExp::toElem(IRState *irs)
{
assert(0);
View
@@ -291,19 +291,6 @@ Expression *NotExp::optimize(int result, bool keepLvalue)
return e;
}
Expression *BoolExp::optimize(int result, bool keepLvalue)
{ Expression *e;
e1 = e1->optimize(result);
if (e1->isConst() == 1)
{
e = Bool(type, e1);
}
else
e = this;
return e;
}
Expression *SymOffExp::optimize(int result, bool keepLvalue)
{
assert(var);
@@ -1123,9 +1110,7 @@ Expression *AndAndExp::optimize(int result, bool keepLvalue)
}
else if (e1->isBool(true))
{
if (type->toBasetype()->ty == Tvoid)
e = e2;
else e = new BoolExp(loc, e2, type);
e = e2;
}
}
}
@@ -1163,10 +1148,7 @@ Expression *OrOrExp::optimize(int result, bool keepLvalue)
}
else if (e1->isBool(false))
{
if (type->toBasetype()->ty == Tvoid)
e = e2;
else
e = new BoolExp(loc, e2, type);
e = e2;
}
}
}

0 comments on commit eb1158e

Please sign in to comment.