Remove unused extra argument to overload checking functions.

This commit is contained in:
David Nadlinger
2013-06-07 21:23:19 +02:00
parent 4971321caf
commit f7aac5201b
8 changed files with 34 additions and 49 deletions

View File

@@ -669,7 +669,7 @@ MATCH AddrExp::implicitConvTo(Type *t)
{ Dsymbol *s = eo->vars->a[i];
FuncDeclaration *f2 = s->isFuncDeclaration();
assert(f2);
if (f2->overloadExactMatch(t->nextOf(), m))
if (f2->overloadExactMatch(t->nextOf()))
{ if (f)
/* Error if match in more than one overload set,
* even if one is a 'better' match than the other.
@@ -695,7 +695,7 @@ MATCH AddrExp::implicitConvTo(Type *t)
#endif
VarExp *ve = (VarExp *)e1;
FuncDeclaration *f = ve->var->isFuncDeclaration();
if (f && f->overloadExactMatch(t->nextOf(), m))
if (f && f->overloadExactMatch(t->nextOf()))
result = MATCHexact;
}
}
@@ -725,7 +725,7 @@ MATCH SymOffExp::implicitConvTo(Type *t)
{
f = var->isFuncDeclaration();
if (f)
{ f = f->overloadExactMatch(t->nextOf(), m);
{ f = f->overloadExactMatch(t->nextOf());
if (f)
{ if ((t->ty == Tdelegate && (f->needThis() || f->isNested())) ||
(t->ty == Tpointer && !(f->needThis() || f->isNested())))
@@ -758,7 +758,7 @@ MATCH DelegateExp::implicitConvTo(Type *t)
if (type->ty == Tdelegate &&
t->ty == Tdelegate)
{
if (func && func->overloadExactMatch(t->nextOf(), m))
if (func && func->overloadExactMatch(t->nextOf()))
result = MATCHexact;
}
}
@@ -1422,7 +1422,7 @@ Expression *AddrExp::castTo(Scope *sc, Type *t)
{ Dsymbol *s = eo->vars->a[i];
FuncDeclaration *f2 = s->isFuncDeclaration();
assert(f2);
if (f2->overloadExactMatch(t->nextOf(), m))
if (f2->overloadExactMatch(t->nextOf()))
{ if (f)
/* Error if match in more than one overload set,
* even if one is a 'better' match than the other.
@@ -1435,7 +1435,7 @@ Expression *AddrExp::castTo(Scope *sc, Type *t)
#if IN_LLVM
if (f)
{
f = f->overloadExactMatch(tb->nextOf(), m);
f = f->overloadExactMatch(tb->nextOf());
if (f)
{
if (tb->ty == Tdelegate)
@@ -1495,7 +1495,7 @@ Expression *AddrExp::castTo(Scope *sc, Type *t)
#if !IN_LLVM
assert(0); // should be SymOffExp instead
#endif
f = f->overloadExactMatch(tb->nextOf(), m);
f = f->overloadExactMatch(tb->nextOf());
if (f)
{
e = new VarExp(loc, f);
@@ -1652,7 +1652,7 @@ Expression *SymOffExp::castTo(Scope *sc, Type *t)
f = var->isFuncDeclaration();
if (f)
{
f = f->overloadExactMatch(tb->nextOf(), m);
f = f->overloadExactMatch(tb->nextOf());
if (f)
{
if (tb->ty == Tdelegate)
@@ -1719,7 +1719,7 @@ Expression *DelegateExp::castTo(Scope *sc, Type *t)
{
if (func)
{
f = func->overloadExactMatch(tb->nextOf(), m);
f = func->overloadExactMatch(tb->nextOf());
if (f)
{ int offset;
if (f->tintro && f->tintro->nextOf()->isBaseOf(f->type->nextOf(), &offset) && offset)

View File

@@ -124,7 +124,7 @@ struct Match
};
void overloadResolveX(Match *m, FuncDeclaration *f,
Expression *ethis, Expressions *arguments, Module* from);
Expression *ethis, Expressions *arguments);
int overloadApply(FuncDeclaration *fstart,
int (*fp)(void *, FuncDeclaration *),
void *param);
@@ -851,8 +851,8 @@ struct FuncDeclaration : Declaration
int overrides(FuncDeclaration *fd);
int findVtblIndex(Dsymbols *vtbl, int dim);
int overloadInsert(Dsymbol *s);
FuncDeclaration *overloadExactMatch(Type *t, Module* from);
FuncDeclaration *overloadResolve(Loc loc, Expression *ethis, Expressions *arguments, int flags = 0, Module* from=NULL);
FuncDeclaration *overloadExactMatch(Type *t);
FuncDeclaration *overloadResolve(Loc loc, Expression *ethis, Expressions *arguments, int flags = 0);
MATCH leastAsSpecialized(FuncDeclaration *g);
LabelDsymbol *searchLabel(Identifier *ident);
AggregateDeclaration *isThis();

View File

@@ -4990,7 +4990,6 @@ SymOffExp::SymOffExp(Loc loc, Declaration *var, unsigned offset, int hasOverload
: SymbolExp(loc, TOKsymoff, sizeof(SymOffExp), var, hasOverloads)
{
this->offset = offset;
m = NULL;
VarDeclaration *v = var->isVarDeclaration();
if (v && v->needThis())
error("need 'this' for address of %s", v->toChars());
@@ -5002,7 +5001,6 @@ Expression *SymOffExp::semantic(Scope *sc)
printf("SymOffExp::semantic('%s')\n", toChars());
#endif
//var->semantic(sc);
m = sc->module;
if (!type)
type = var->type->pointerTo();
VarDeclaration *v = var->isVarDeclaration();
@@ -7485,7 +7483,6 @@ Expression *DelegateExp::semantic(Scope *sc)
#endif
if (!type)
{
m = sc->module;
e1 = e1->semantic(sc);
#if IN_LLVM
// LDC we need a copy as we store the LLVM type in TypeFunction,
@@ -8577,9 +8574,6 @@ void CallExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
AddrExp::AddrExp(Loc loc, Expression *e)
: UnaExp(loc, TOKaddress, sizeof(AddrExp), e)
{
#if IN_LLVM
m = NULL;
#endif
}
Expression *AddrExp::semantic(Scope *sc)
@@ -8589,9 +8583,6 @@ Expression *AddrExp::semantic(Scope *sc)
#endif
if (!type)
{
#if IN_LLVM
m = sc->module;
#endif
UnaExp::semantic(sc);
Expression *olde1 = e1;
if (e1->type == Type::terror)

View File

@@ -741,7 +741,6 @@ struct SymbolExp : Expression
struct SymOffExp : SymbolExp
{
unsigned offset;
Module* m; // starting point for overload resolution
SymOffExp(Loc loc, Declaration *var, unsigned offset, int hasOverloads = 0);
Expression *semantic(Scope *sc);
@@ -1102,7 +1101,6 @@ struct DotTemplateInstanceExp : UnaExp
struct DelegateExp : UnaExp
{
FuncDeclaration *func;
Module* m; // starting point for overload resolution
int hasOverloads;
DelegateExp(Loc loc, Expression *e, FuncDeclaration *func, int hasOverloads = 0);
@@ -1177,8 +1175,6 @@ struct CallExp : UnaExp
struct AddrExp : UnaExp
{
Module* m; // starting point for overload resolution
AddrExp(Loc loc, Expression *e);
Expression *semantic(Scope *sc);
void checkEscape();

View File

@@ -513,7 +513,7 @@ void FuncDeclaration::semantic(Scope *sc)
if (s)
{
FuncDeclaration *f = s->isFuncDeclaration();
f = f->overloadExactMatch(type, getModule());
f = f->overloadExactMatch(type);
if (f && f->isFinal() && f->prot() != PROTprivate)
error("cannot override final function %s", f->toPrettyChars());
}
@@ -724,7 +724,7 @@ void FuncDeclaration::semantic(Scope *sc)
FuncDeclaration *f = s->isFuncDeclaration();
if (f)
{
f = f->overloadExactMatch(type, getModule());
f = f->overloadExactMatch(type);
if (f && f->isFinal() && f->prot() != PROTprivate)
error("cannot override final function %s.%s", b->base->toChars(), f->toPrettyChars());
}
@@ -2599,7 +2599,7 @@ int fp1(void *param, FuncDeclaration *f)
return 0;
}
FuncDeclaration *FuncDeclaration::overloadExactMatch(Type *t, Module* from)
FuncDeclaration *FuncDeclaration::overloadExactMatch(Type *t)
{
Param1 p;
p.t = t;
@@ -2719,7 +2719,7 @@ int fp2(void *param, FuncDeclaration *f)
void overloadResolveX(Match *m, FuncDeclaration *fstart,
Expression *ethis, Expressions *arguments, Module* from)
Expression *ethis, Expressions *arguments)
{
Param2 p;
p.m = m;
@@ -2752,7 +2752,7 @@ static void MODMatchToBuffer(OutBuffer *buf, unsigned char lhsMod, unsigned char
buf->writestring("mutable ");
}
FuncDeclaration *FuncDeclaration::overloadResolve(Loc loc, Expression *ethis, Expressions *arguments, int flags, Module* from)
FuncDeclaration *FuncDeclaration::overloadResolve(Loc loc, Expression *ethis, Expressions *arguments, int flags)
{
TypeFunction *tf;
Match m;
@@ -2775,7 +2775,7 @@ if (arguments)
memset(&m, 0, sizeof(m));
m.last = MATCHnomatch;
overloadResolveX(&m, this, ethis, arguments, from);
overloadResolveX(&m, this, ethis, arguments);
if (m.count == 1) // exactly one match
{

View File

@@ -13,10 +13,10 @@
#include <ctype.h>
#include <assert.h>
#include <string.h> // memset()
#if _MSC_VER
#if _MSC_VER || IN_LLVM // complex.h breaks LLVM headers.
#include <complex>
#else
#include <complex>
#include <complex.h>
#endif
#ifdef __APPLE__
@@ -35,7 +35,6 @@
#include "declaration.h"
#include "aggregate.h"
#include "template.h"
#include "scope.h"
static Dsymbol *inferApplyArgTypesX(Expression *ethis, FuncDeclaration *fstart, Parameters *arguments);
static void inferApplyArgTypesZ(TemplateDeclaration *tstart, Parameters *arguments);
@@ -538,7 +537,7 @@ Expression *BinExp::op_overload(Scope *sc)
FuncDeclaration *fd = s->isFuncDeclaration();
if (fd)
{
overloadResolveX(&m, fd, NULL, &args2, sc->module);
overloadResolveX(&m, fd, NULL, &args2);
}
else
{ TemplateDeclaration *td = s->isTemplateDeclaration();
@@ -553,7 +552,7 @@ Expression *BinExp::op_overload(Scope *sc)
FuncDeclaration *fd = s_r->isFuncDeclaration();
if (fd)
{
overloadResolveX(&m, fd, NULL, &args1, sc->module);
overloadResolveX(&m, fd, NULL, &args1);
}
else
{ TemplateDeclaration *td = s_r->isTemplateDeclaration();
@@ -631,7 +630,7 @@ L1:
FuncDeclaration *fd = s_r->isFuncDeclaration();
if (fd)
{
overloadResolveX(&m, fd, NULL, &args2, sc->module);
overloadResolveX(&m, fd, NULL, &args2);
}
else
{ TemplateDeclaration *td = s_r->isTemplateDeclaration();
@@ -645,7 +644,7 @@ L1:
FuncDeclaration *fd = s->isFuncDeclaration();
if (fd)
{
overloadResolveX(&m, fd, NULL, &args1, sc->module);
overloadResolveX(&m, fd, NULL, &args1);
}
else
{ TemplateDeclaration *td = s->isTemplateDeclaration();
@@ -794,7 +793,7 @@ Expression *BinExp::compare_overload(Scope *sc, Identifier *id)
FuncDeclaration *fd = s->isFuncDeclaration();
if (fd)
{
overloadResolveX(&m, fd, NULL, &args2, sc->module);
overloadResolveX(&m, fd, NULL, &args2);
}
else
{ TemplateDeclaration *td = s->isTemplateDeclaration();
@@ -810,7 +809,7 @@ Expression *BinExp::compare_overload(Scope *sc, Identifier *id)
FuncDeclaration *fd = s_r->isFuncDeclaration();
if (fd)
{
overloadResolveX(&m, fd, NULL, &args1, sc->module);
overloadResolveX(&m, fd, NULL, &args1);
}
else
{ TemplateDeclaration *td = s_r->isTemplateDeclaration();
@@ -1108,7 +1107,7 @@ Expression *BinAssignExp::op_overload(Scope *sc)
FuncDeclaration *fd = s->isFuncDeclaration();
if (fd)
{
overloadResolveX(&m, fd, NULL, &args2, sc->module);
overloadResolveX(&m, fd, NULL, &args2);
}
else
{ TemplateDeclaration *td = s->isTemplateDeclaration();

View File

@@ -613,9 +613,9 @@ void StructDeclaration::semantic(Scope *sc)
Dsymbol *s = search_function(this, id);
FuncDeclaration *fdx = s ? s->isFuncDeclaration() : NULL;
if (fdx)
{ FuncDeclaration *fd = fdx->overloadExactMatch(tfeqptr, getModule());
{ FuncDeclaration *fd = fdx->overloadExactMatch(tfeqptr);
if (!fd)
{ fd = fdx->overloadExactMatch(tfeq, getModule());
{ fd = fdx->overloadExactMatch(tfeq);
if (fd)
{ // Create the thunk, fdptr
FuncDeclaration *fdptr = new FuncDeclaration(loc, loc, fdx->ident, STCundefined, tfeqptr);

View File

@@ -574,13 +574,13 @@ void TypeInfoDelegateDeclaration::llvmDefine()
/* ========================================================================= */
static FuncDeclaration* find_method_overload(AggregateDeclaration* ad, Identifier* id, TypeFunction* tf, Module* mod)
static FuncDeclaration* find_method_overload(AggregateDeclaration* ad, Identifier* id, TypeFunction* tf)
{
Dsymbol *s = search_function(ad, id);
FuncDeclaration *fdx = s ? s->isFuncDeclaration() : NULL;
if (fdx)
{
FuncDeclaration *fd = fdx->overloadExactMatch(tf, mod);
FuncDeclaration *fd = fdx->overloadExactMatch(tf);
if (fd)
{
return fd;
@@ -656,10 +656,9 @@ void TypeInfoStructDeclaration::llvmDefine()
}
// well use this module for all overload lookups
Module *gm = getModule();
// toHash
FuncDeclaration* fd = find_method_overload(sd, Id::tohash, tftohash, gm);
FuncDeclaration* fd = find_method_overload(sd, Id::tohash, tftohash);
b.push_funcptr(fd);
// opEquals
@@ -667,11 +666,11 @@ void TypeInfoStructDeclaration::llvmDefine()
b.push_funcptr(fd);
// opCmp
fd = find_method_overload(sd, Id::cmp, tfcmpptr, gm);
fd = find_method_overload(sd, Id::cmp, tfcmpptr);
b.push_funcptr(fd);
// toString
fd = find_method_overload(sd, Id::tostring, tftostring, gm);
fd = find_method_overload(sd, Id::tostring, tftostring);
b.push_funcptr(fd);
// uint m_flags;