Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleanup] Remove Expression::dump and replace usages with Expression::print #3114

Merged
merged 1 commit into from Jan 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cast.c
Expand Up @@ -2163,7 +2163,7 @@ bool isVoidArrayLiteral(Expression *e, Type *other)
int typeMerge(Scope *sc, Expression *e, Type **pt, Expression **pe1, Expression **pe2)
{
//printf("typeMerge() %s op %s\n", (*pe1)->toChars(), (*pe2)->toChars());
//e->dump(0);
//e->print();

MATCH m;
Expression *e1 = *pe1;
Expand Down Expand Up @@ -2230,7 +2230,7 @@ int typeMerge(Scope *sc, Expression *e, Type **pt, Expression **pe1, Expression
e1 = e1->castTo(sc, t1);
e2 = e2->castTo(sc, t2);
//printf("after typeCombine():\n");
//dump(0);
//print();
//printf("ty = %d, ty1 = %d, ty2 = %d\n", ty, ty1, ty2);
goto Lret;
}
Expand Down Expand Up @@ -2726,7 +2726,7 @@ int typeMerge(Scope *sc, Expression *e, Type **pt, Expression **pe1, Expression
if (e2->type) printf("\tt2 = %s\n", e2->type->toChars());
printf("\ttype = %s\n", t->toChars());
#endif
//dump(0);
//print();
return 1;


Expand Down
3 changes: 1 addition & 2 deletions src/declaration.c
Expand Up @@ -764,7 +764,6 @@ Dsymbol *VarDeclaration::syntaxCopy(Dsymbol *s)
if (this->init)
{ init = this->init->syntaxCopy();
//init->isExpInitializer()->exp->print();
//init->isExpInitializer()->exp->dump(0);
}

sv = new VarDeclaration(loc, type ? type->syntaxCopy() : NULL, ident, init);
Expand Down Expand Up @@ -1573,7 +1572,7 @@ void VarDeclaration::semantic2(Scope *sc)
ExpInitializer *ei = init->isExpInitializer();
if (ei)
{
ei->exp->dump(0);
ei->exp->print();
printf("type = %p\n", ei->exp->type);
}
#endif
Expand Down
152 changes: 0 additions & 152 deletions src/dump.c

This file was deleted.

6 changes: 3 additions & 3 deletions src/e2ir.c
Expand Up @@ -2267,7 +2267,7 @@ elem *CmpExp::toElem(IRState *irs)
case TOKug: eop = OPug; break;
case TOKue: eop = OPue; break;
default:
dump(0);
print();
assert(0);
}
if (!t1->isfloating())
Expand Down Expand Up @@ -2338,7 +2338,7 @@ elem *EqualExp::toElem(IRState *irs)
case TOKequal: eop = OPeqeq; break;
case TOKnotequal: eop = OPne; break;
default:
dump(0);
print();
assert(0);
}

Expand Down Expand Up @@ -2477,7 +2477,7 @@ elem *IdentityExp::toElem(IRState *irs)
case TOKidentity: eop = OPeqeq; break;
case TOKnotidentity: eop = OPne; break;
default:
dump(0);
print();
assert(0);
}

Expand Down
10 changes: 5 additions & 5 deletions src/expression.c
Expand Up @@ -1826,7 +1826,7 @@ void expToCBuffer(OutBuffer *buf, HdrGenState *hgs, Expression *e, PREC pr)
assert(precedence[e->op] != PREC_zero);
assert(pr != PREC_zero);

//if (precedence[e->op] == 0) e->dump(0);
//if (precedence[e->op] == 0) e->print();
if (precedence[e->op] < pr ||
/* Despite precedence, we don't allow a<b<c expressions.
* They must be parenthesized.
Expand Down Expand Up @@ -1938,7 +1938,7 @@ void Expression::init()
Expression *Expression::syntaxCopy()
{
//printf("Expression::syntaxCopy()\n");
//dump(0);
//print();
return copy();
}

Expand All @@ -1954,7 +1954,7 @@ Expression *Expression::copy()
#ifdef DEBUG
fprintf(stderr, "No expression copy for: %s\n", toChars());
printf("op = %d\n", op);
dump(0);
print();
#endif
assert(0);
}
Expand Down Expand Up @@ -2056,7 +2056,7 @@ int Expression::rvalue(bool allowVoid)
{
error("expression %s is void and has no value", toChars());
#if 0
dump(0);
print();
halt();
#endif
if (!global.gag)
Expand Down Expand Up @@ -2490,7 +2490,7 @@ Expression *Expression::checkToBoolean(Scope *sc)

#ifdef DEBUG
if (!type)
dump(0);
print();
assert(type);
#endif

Expand Down
13 changes: 0 additions & 13 deletions src/expression.h
Expand Up @@ -132,7 +132,6 @@ class Expression : public RootObject

void print();
char *toChars();
virtual void dump(int indent);
void error(const char *format, ...);
void warning(const char *format, ...);
void deprecation(const char *format, ...);
Expand Down Expand Up @@ -227,7 +226,6 @@ class IntegerExp : public Expression
Expression *semantic(Scope *sc);
Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue);
char *toChars();
void dump(int indent);
IntRange getIntRange();
dinteger_t toInteger();
real_t toReal();
Expand Down Expand Up @@ -313,7 +311,6 @@ class IdentifierExp : public Expression
static IdentifierExp *create(Loc loc, Identifier *ident);
Expression *semantic(Scope *sc);
char *toChars();
void dump(int indent);
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
int isLvalue();
Expression *toLvalue(Scope *sc, Expression *e);
Expand All @@ -334,7 +331,6 @@ class DsymbolExp : public Expression
DsymbolExp(Loc loc, Dsymbol *s, bool hasOverloads = false);
Expression *semantic(Scope *sc);
char *toChars();
void dump(int indent);
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
int isLvalue();
Expression *toLvalue(Scope *sc, Expression *e);
Expand Down Expand Up @@ -713,7 +709,6 @@ class VarExp : public SymbolExp
Expression *semantic(Scope *sc);
Expression *optimize(int result, bool keepLvalue = false);
Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue);
void dump(int indent);
char *toChars();
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
void checkEscape();
Expand Down Expand Up @@ -860,7 +855,6 @@ class UnaExp : public Expression
Expression *semantic(Scope *sc);
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
Expression *optimize(int result, bool keepLvalue = false);
void dump(int indent);
Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue);
Expression *resolveLoc(Loc loc, Scope *sc);

Expand Down Expand Up @@ -894,7 +888,6 @@ class BinExp : public Expression
Expression *optimize(int result, bool keepLvalue = false);
int isunsigned();
Expression *incompatibleTypes();
void dump(int indent);

Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue);
Expression *interpretCommon(InterState *istate, CtfeGoal goal, fp_t fp);
Expand Down Expand Up @@ -986,7 +979,6 @@ class DotIdExp : public UnaExp
Expression *semanticX(Scope *sc);
Expression *semanticY(Scope *sc, int flag);
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
void dump(int i);
};

class DotTemplateExp : public UnaExp
Expand All @@ -1013,7 +1005,6 @@ class DotVarExp : public UnaExp
Expression *optimize(int result, bool keepLvalue = false);
Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue);
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
void dump(int indent);
elem *toElem(IRState *irs);
};

Expand All @@ -1028,7 +1019,6 @@ class DotTemplateInstanceExp : public UnaExp
Expression *semantic(Scope *sc);
Expression *semanticY(Scope *sc, int flag);
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
void dump(int indent);
};

class DelegateExp : public UnaExp
Expand All @@ -1043,7 +1033,6 @@ class DelegateExp : public UnaExp
MATCH implicitConvTo(Type *t);
Expression *castTo(Scope *sc, Type *t);
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
void dump(int indent);

int inlineCost3(InlineCostState *ics);
elem *toElem(IRState *irs);
Expand Down Expand Up @@ -1081,7 +1070,6 @@ class CallExp : public UnaExp
Expression *optimize(int result, bool keepLvalue = false);
Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue);
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
void dump(int indent);
elem *toElem(IRState *irs);
int isLvalue();
Expression *toLvalue(Scope *sc, Expression *e);
Expand Down Expand Up @@ -1264,7 +1252,6 @@ class SliceExp : public UnaExp
Expression *castTo(Scope *sc, Type *t);
Expression *optimize(int result, bool keepLvalue = false);
Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue);
void dump(int indent);
elem *toElem(IRState *irs);
void buildArrayIdent(OutBuffer *buf, Expressions *arguments);
Expression *buildArrayLoop(Parameters *fparams);
Expand Down
4 changes: 2 additions & 2 deletions src/inline.c
Expand Up @@ -190,7 +190,7 @@ int lambdaInlineCost(Expression *e, void *param)
int expressionInlineCost(Expression *e, InlineCostState *ics)
{
//printf("expressionInlineCost()\n");
//e->dump(0);
//e->print();
ICS2 ics2;
ics2.cost = 0;
ics2.ics = ics;
Expand Down Expand Up @@ -1839,7 +1839,7 @@ Expression *FuncDeclaration::expandInline(InlineScanState *iss,
inlineNest--;
//eb->type->print();
//eb->print();
//eb->dump(0);
//eb->print();

// Bugzilla 11322:
if (tf->isref)
Expand Down
2 changes: 1 addition & 1 deletion src/interpret.c
Expand Up @@ -2025,7 +2025,7 @@ Expression *Expression::interpret(InterState *istate, CtfeGoal goal)
#if LOG
printf("%s Expression::interpret() %s\n", loc.toChars(), toChars());
printf("type = %s\n", type->toChars());
dump(0);
print();
#endif
error("Cannot interpret %s at compile time", toChars());
return EXP_CANT_INTERPRET;
Expand Down