d: Merge upstream dmd 6d5bffa54

Removes an unused parameter from Condition::include(), all callers have
been updated in the front-end.

Reviewed-on: https://github.com/dlang/dmd/pull/11229

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 6d5bffa54.
	* d-builtins.cc (maybe_set_builtin_1): Update call to
	Condition::include().
	* decl.cc (DeclVisitor::visit(AttribDeclaration *)): Likewise.
	* types.cc (layout_aggregate_members): Likewise.
This commit is contained in:
Iain Buclaw 2020-06-05 11:37:47 +02:00
parent 9758d196f5
commit d3da83f66f
18 changed files with 52 additions and 61 deletions

View File

@ -668,7 +668,7 @@ maybe_set_builtin_1 (Dsymbol *d)
if (ad != NULL)
{
/* Recursively search through attribute decls. */
Dsymbols *decls = ad->include (NULL, NULL);
Dsymbols *decls = ad->include (NULL);
if (decls && decls->length)
{
for (size_t i = 0; i < decls->length; i++)

View File

@ -232,7 +232,7 @@ public:
void visit (AttribDeclaration *d)
{
Dsymbols *ds = d->include (NULL, NULL);
Dsymbols *ds = d->include (NULL);
if (!ds)
return;

View File

@ -1,4 +1,4 @@
48d704f082ebe8b199a9ef7712c223216cd70d3a
6d5bffa54f7da21d388d9999e586fd8a11ebcdb1
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.

View File

@ -41,7 +41,7 @@ AttribDeclaration::AttribDeclaration(Dsymbols *decl)
this->decl = decl;
}
Dsymbols *AttribDeclaration::include(Scope *, ScopeDsymbol *)
Dsymbols *AttribDeclaration::include(Scope *)
{
if (errors)
return NULL;
@ -51,7 +51,7 @@ Dsymbols *AttribDeclaration::include(Scope *, ScopeDsymbol *)
int AttribDeclaration::apply(Dsymbol_apply_ft_t fp, void *param)
{
Dsymbols *d = include(_scope, NULL);
Dsymbols *d = include(_scope);
if (d)
{
@ -111,7 +111,7 @@ Scope *AttribDeclaration::newScope(Scope *sc)
void AttribDeclaration::addMember(Scope *sc, ScopeDsymbol *sds)
{
Dsymbols *d = include(sc, sds);
Dsymbols *d = include(sc);
if (d)
{
@ -131,7 +131,7 @@ void AttribDeclaration::addMember(Scope *sc, ScopeDsymbol *sds)
void AttribDeclaration::setScope(Scope *sc)
{
Dsymbols *d = include(sc, NULL);
Dsymbols *d = include(sc);
//printf("\tAttribDeclaration::setScope '%s', d = %p\n",toChars(), d);
if (d)
@ -151,7 +151,7 @@ void AttribDeclaration::setScope(Scope *sc)
void AttribDeclaration::importAll(Scope *sc)
{
Dsymbols *d = include(sc, NULL);
Dsymbols *d = include(sc);
//printf("\tAttribDeclaration::importAll '%s', d = %p\n", toChars(), d);
if (d)
@ -174,7 +174,7 @@ void AttribDeclaration::semantic(Scope *sc)
if (semanticRun != PASSinit)
return;
semanticRun = PASSsemantic;
Dsymbols *d = include(sc, NULL);
Dsymbols *d = include(sc);
//printf("\tAttribDeclaration::semantic '%s', d = %p\n",toChars(), d);
if (d)
@ -195,7 +195,7 @@ void AttribDeclaration::semantic(Scope *sc)
void AttribDeclaration::semantic2(Scope *sc)
{
Dsymbols *d = include(sc, NULL);
Dsymbols *d = include(sc);
if (d)
{
@ -214,7 +214,7 @@ void AttribDeclaration::semantic2(Scope *sc)
void AttribDeclaration::semantic3(Scope *sc)
{
Dsymbols *d = include(sc, NULL);
Dsymbols *d = include(sc);
if (d)
{
@ -236,7 +236,7 @@ void AttribDeclaration::addComment(const utf8_t *comment)
//printf("AttribDeclaration::addComment %s\n", comment);
if (comment)
{
Dsymbols *d = include(NULL, NULL);
Dsymbols *d = include(NULL);
if (d)
{
@ -252,7 +252,7 @@ void AttribDeclaration::addComment(const utf8_t *comment)
void AttribDeclaration::setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion)
{
Dsymbols *d = include(NULL, NULL);
Dsymbols *d = include(NULL);
if (d)
{
@ -266,7 +266,7 @@ void AttribDeclaration::setFieldOffset(AggregateDeclaration *ad, unsigned *poffs
bool AttribDeclaration::hasPointers()
{
Dsymbols *d = include(NULL, NULL);
Dsymbols *d = include(NULL);
if (d)
{
@ -282,7 +282,7 @@ bool AttribDeclaration::hasPointers()
bool AttribDeclaration::hasStaticCtorOrDtor()
{
Dsymbols *d = include(NULL, NULL);
Dsymbols *d = include(NULL);
if (d)
{
@ -303,14 +303,14 @@ const char *AttribDeclaration::kind() const
bool AttribDeclaration::oneMember(Dsymbol **ps, Identifier *ident)
{
Dsymbols *d = include(NULL, NULL);
Dsymbols *d = include(NULL);
return Dsymbol::oneMembers(d, ps, ident);
}
void AttribDeclaration::checkCtorConstInit()
{
Dsymbols *d = include(NULL, NULL);
Dsymbols *d = include(NULL);
if (d)
{
@ -327,7 +327,7 @@ void AttribDeclaration::checkCtorConstInit()
void AttribDeclaration::addLocalClass(ClassDeclarations *aclasses)
{
Dsymbols *d = include(NULL, NULL);
Dsymbols *d = include(NULL);
if (d)
{
@ -383,7 +383,7 @@ bool StorageClassDeclaration::oneMember(Dsymbol **ps, Identifier *ident)
void StorageClassDeclaration::addMember(Scope *sc, ScopeDsymbol *sds)
{
Dsymbols *d = include(sc, sds);
Dsymbols *d = include(sc);
if (d)
{
Scope *sc2 = newScope(sc);
@ -922,7 +922,7 @@ static unsigned setMangleOverride(Dsymbol *s, char *sym)
if (ad)
{
Dsymbols *decls = ad->include(NULL, NULL);
Dsymbols *decls = ad->include(NULL);
unsigned nestedCount = 0;
if (decls && decls->length)
@ -1207,7 +1207,7 @@ bool ConditionalDeclaration::oneMember(Dsymbol **ps, Identifier *ident)
//printf("ConditionalDeclaration::oneMember(), inc = %d\n", condition->inc);
if (condition->inc)
{
Dsymbols *d = condition->include(NULL, NULL) ? decl : elsedecl;
Dsymbols *d = condition->include(NULL) ? decl : elsedecl;
return Dsymbol::oneMembers(d, ps, ident);
}
else
@ -1221,7 +1221,7 @@ bool ConditionalDeclaration::oneMember(Dsymbol **ps, Identifier *ident)
// Decide if 'then' or 'else' code should be included
Dsymbols *ConditionalDeclaration::include(Scope *sc, ScopeDsymbol *sds)
Dsymbols *ConditionalDeclaration::include(Scope *sc)
{
//printf("ConditionalDeclaration::include(sc = %p) _scope = %p\n", sc, _scope);
@ -1229,12 +1229,12 @@ Dsymbols *ConditionalDeclaration::include(Scope *sc, ScopeDsymbol *sds)
return NULL;
assert(condition);
return condition->include(_scope ? _scope : sc, sds) ? decl : elsedecl;
return condition->include(_scope ? _scope : sc) ? decl : elsedecl;
}
void ConditionalDeclaration::setScope(Scope *sc)
{
Dsymbols *d = include(sc, NULL);
Dsymbols *d = include(sc);
//printf("\tConditionalDeclaration::setScope '%s', d = %p\n",toChars(), d);
if (d)
@ -1299,7 +1299,7 @@ Dsymbol *StaticIfDeclaration::syntaxCopy(Dsymbol *s)
* Different from other AttribDeclaration subclasses, include() call requires
* the completion of addMember and setScope phases.
*/
Dsymbols *StaticIfDeclaration::include(Scope *sc, ScopeDsymbol *)
Dsymbols *StaticIfDeclaration::include(Scope *sc)
{
//printf("StaticIfDeclaration::include(sc = %p) _scope = %p\n", sc, _scope);
@ -1313,7 +1313,7 @@ Dsymbols *StaticIfDeclaration::include(Scope *sc, ScopeDsymbol *)
assert(scopesym); // addMember is already done
assert(_scope); // setScope is already done
d = ConditionalDeclaration::include(_scope, scopesym);
d = ConditionalDeclaration::include(_scope);
if (d && !addisdone)
{
@ -1338,7 +1338,7 @@ Dsymbols *StaticIfDeclaration::include(Scope *sc, ScopeDsymbol *)
}
else
{
d = ConditionalDeclaration::include(sc, scopesym);
d = ConditionalDeclaration::include(sc);
onStack = false;
return d;
}
@ -1423,7 +1423,7 @@ bool StaticForeachDeclaration::oneMember(Dsymbol **ps, Identifier *ident)
return false;
}
Dsymbols *StaticForeachDeclaration::include(Scope *, ScopeDsymbol *)
Dsymbols *StaticForeachDeclaration::include(Scope *)
{
if (errors || onStack)
return NULL;

View File

@ -28,7 +28,7 @@ public:
Dsymbols *decl; // array of Dsymbol's
AttribDeclaration(Dsymbols *decl);
virtual Dsymbols *include(Scope *sc, ScopeDsymbol *sds);
virtual Dsymbols *include(Scope *sc);
int apply(Dsymbol_apply_ft_t fp, void *param);
static Scope *createNewScope(Scope *sc,
StorageClass newstc, LINK linkage, CPPMANGLE cppmangle, Prot protection,
@ -180,7 +180,7 @@ public:
ConditionalDeclaration(Condition *condition, Dsymbols *decl, Dsymbols *elsedecl);
Dsymbol *syntaxCopy(Dsymbol *s);
bool oneMember(Dsymbol **ps, Identifier *ident);
Dsymbols *include(Scope *sc, ScopeDsymbol *sds);
Dsymbols *include(Scope *sc);
void addComment(const utf8_t *comment);
void setScope(Scope *sc);
void accept(Visitor *v) { v->visit(this); }
@ -195,7 +195,7 @@ public:
StaticIfDeclaration(Condition *condition, Dsymbols *decl, Dsymbols *elsedecl);
Dsymbol *syntaxCopy(Dsymbol *s);
Dsymbols *include(Scope *sc, ScopeDsymbol *sds);
Dsymbols *include(Scope *sc);
void addMember(Scope *sc, ScopeDsymbol *sds);
void setScope(Scope *sc);
void importAll(Scope *sc);
@ -216,7 +216,7 @@ public:
StaticForeachDeclaration(StaticForeach *sfe, Dsymbols *decl);
Dsymbol *syntaxCopy(Dsymbol *s);
bool oneMember(Dsymbol **ps, Identifier *ident);
Dsymbols *include(Scope *sc, ScopeDsymbol *sds);
Dsymbols *include(Scope *sc);
void addMember(Scope *sc, ScopeDsymbol *sds);
void addComment(const utf8_t *comment);
void setScope(Scope *sc);

View File

@ -250,7 +250,7 @@ bool Dsymbol_canThrow(Dsymbol *s, FuncDeclaration *func, bool mustNotThrow)
ad = s->isAttribDeclaration();
if (ad)
{
Dsymbols *decl = ad->include(NULL, NULL);
Dsymbols *decl = ad->include(NULL);
if (decl && decl->length)
{
for (size_t i = 0; i < decl->length; i++)

View File

@ -430,7 +430,7 @@ void printDepsConditional(Scope *sc, DVCondition* condition, const char* depType
}
int DebugCondition::include(Scope *sc, ScopeDsymbol *)
int DebugCondition::include(Scope *sc)
{
//printf("DebugCondition::include() level = %d, debuglevel = %d\n", level, global.params.debuglevel);
if (inc == 0)
@ -609,7 +609,7 @@ VersionCondition::VersionCondition(Module *mod, unsigned level, Identifier *iden
{
}
int VersionCondition::include(Scope *sc, ScopeDsymbol *)
int VersionCondition::include(Scope *sc)
{
//printf("VersionCondition::include() level = %d, versionlevel = %d\n", level, global.params.versionlevel);
//if (ident) printf("\tident = '%s'\n", ident->toChars());
@ -654,7 +654,7 @@ Condition *StaticIfCondition::syntaxCopy()
return new StaticIfCondition(loc, exp->syntaxCopy());
}
int StaticIfCondition::include(Scope *sc, ScopeDsymbol *sds)
int StaticIfCondition::include(Scope *sc)
{
if (inc == 0)
{
@ -666,7 +666,6 @@ int StaticIfCondition::include(Scope *sc, ScopeDsymbol *sds)
}
sc = sc->push(sc->scopesym);
sc->sds = sds; // sds gets any addMember()
bool errors = false;
bool result = evalStaticCondition(sc, exp, exp, errors);

View File

@ -37,7 +37,7 @@ public:
Condition(Loc loc);
virtual Condition *syntaxCopy() = 0;
virtual int include(Scope *sc, ScopeDsymbol *sds) = 0;
virtual int include(Scope *sc) = 0;
virtual DebugCondition *isDebugCondition() { return NULL; }
virtual VersionCondition *isVersionCondition() { return NULL; }
virtual void accept(Visitor *v) { v->visit(this); }
@ -81,7 +81,7 @@ public:
DebugCondition(Module *mod, unsigned level, Identifier *ident);
int include(Scope *sc, ScopeDsymbol *sds);
int include(Scope *sc);
DebugCondition *isDebugCondition() { return this; }
void accept(Visitor *v) { v->visit(this); }
};
@ -95,7 +95,7 @@ public:
VersionCondition(Module *mod, unsigned level, Identifier *ident);
int include(Scope *sc, ScopeDsymbol *sds);
int include(Scope *sc);
VersionCondition *isVersionCondition() { return this; }
void accept(Visitor *v) { v->visit(this); }
};
@ -107,6 +107,6 @@ public:
StaticIfCondition(Loc loc, Expression *exp);
Condition *syntaxCopy();
int include(Scope *sc, ScopeDsymbol *sds);
int include(Scope *sc);
void accept(Visitor *v) { v->visit(this); }
};

View File

@ -926,7 +926,7 @@ void emitComment(Dsymbol *s, OutBuffer *buf, Scope *sc)
* Hence, Ddoc omits attributes from template members.
*/
Dsymbols *d = ad->include(NULL, NULL);
Dsymbols *d = ad->include(NULL);
if (d)
{
@ -962,7 +962,7 @@ void emitComment(Dsymbol *s, OutBuffer *buf, Scope *sc)
}
/* If generating doc comment, be careful because if we're inside
* a template, then include(NULL, NULL) will fail.
* a template, then include(NULL) will fail.
*/
Dsymbols *d = cd->decl ? cd->decl : cd->elsedecl;
for (size_t i = 0; i < d->length; i++)

View File

@ -64,7 +64,6 @@ Scope::Scope()
//printf("Scope::Scope() %p\n", this);
this->_module = NULL;
this->scopesym = NULL;
this->sds = NULL;
this->enclosing = NULL;
this->parent = NULL;
this->sw = NULL;
@ -151,7 +150,6 @@ Scope *Scope::push()
//printf("Scope::push(this = %p) new = %p\n", this, s);
assert(!(flags & SCOPEfree));
s->scopesym = NULL;
s->sds = NULL;
s->enclosing = this;
s->slabel = NULL;
s->nofree = 0;

View File

@ -1488,7 +1488,7 @@ int ScopeDsymbol_foreach(Scope *sc, Dsymbols *members, ForeachDg dg, void *ctx,
{ Dsymbol *s = (*members)[i];
if (AttribDeclaration *a = s->isAttribDeclaration())
result = ScopeDsymbol_foreach(sc, a->include(sc, NULL), dg, ctx, &n);
result = ScopeDsymbol_foreach(sc, a->include(sc), dg, ctx, &n);
else if (TemplateMixin *tm = s->isTemplateMixin())
result = ScopeDsymbol_foreach(sc, tm->members, dg, ctx, &n);
else if (s->isTemplateInstance())

View File

@ -2160,9 +2160,7 @@ public:
if (m <= MATCHnomatch)
goto Lno;
s->semantic(sc);
if (sc->sds)
s->addMember(sc, sc->sds);
else if (!sc->insert(s))
if (!sc->insert(s))
e->error("declaration %s is already defined", s->toChars());
unSpeculative(sc, s);
@ -2194,8 +2192,6 @@ public:
*/
if (!tup && !sc->insert(s))
e->error("declaration %s is already defined", s->toChars());
if (sc->sds)
s->addMember(sc, sc->sds);
unSpeculative(sc, s);
}

View File

@ -596,7 +596,7 @@ public:
void visit(AttribDeclaration *d)
{
Dsymbols *ds = d->include(NULL, NULL);
Dsymbols *ds = d->include(NULL);
if (ds)
{

View File

@ -72,8 +72,6 @@ struct Scope
Module *_module; // Root module
ScopeDsymbol *scopesym; // current symbol
ScopeDsymbol *sds; // if in static if, and declaring new symbols,
// sds gets the addMember()
FuncDeclaration *func; // function we are in
Dsymbol *parent; // parent to use
LabelStatement *slabel; // enclosing labelled statement

View File

@ -419,18 +419,18 @@ Statement *toStatement(Dsymbol *s)
void visit(ConditionalDeclaration *d)
{
result = visitMembers(d->loc, d->include(NULL, NULL));
result = visitMembers(d->loc, d->include(NULL));
}
void visit(StaticForeachDeclaration *d)
{
assert(d->sfe && !!d->sfe->aggrfe ^ !!d->sfe->rangefe);
result = visitMembers(d->loc, d->include(NULL, NULL));
result = visitMembers(d->loc, d->include(NULL));
}
void visit(CompileDeclaration *d)
{
result = visitMembers(d->loc, d->include(NULL, NULL));
result = visitMembers(d->loc, d->include(NULL));
}
};
@ -993,7 +993,7 @@ Statements *ConditionalStatement::flatten(Scope *sc)
Statement *s;
//printf("ConditionalStatement::flatten()\n");
if (condition->include(sc, NULL))
if (condition->include(sc))
{
DebugCondition *dc = condition->isDebugCondition();
if (dc)

View File

@ -2023,7 +2023,7 @@ public:
// If we can short-circuit evaluate the if statement, don't do the
// semantic analysis of the skipped code.
// This feature allows a limited form of conditional compilation.
if (cs->condition->include(sc, NULL))
if (cs->condition->include(sc))
{
DebugCondition *dc = cs->condition->isDebugCondition();
if (dc)

View File

@ -119,7 +119,7 @@ static void collectUnitTests(Dsymbols *symbols, AA *uniqueUnitTests, Expressions
if (attrDecl)
{
Dsymbols *decl = attrDecl->include(NULL, NULL);
Dsymbols *decl = attrDecl->include(NULL);
collectUnitTests(decl, uniqueUnitTests, unitTests);
}
}

View File

@ -364,7 +364,7 @@ layout_aggregate_members (Dsymbols *members, tree context, bool inherited_p)
AttribDeclaration *attrib = sym->isAttribDeclaration ();
if (attrib != NULL)
{
Dsymbols *decls = attrib->include (NULL, NULL);
Dsymbols *decls = attrib->include (NULL);
if (decls != NULL)
{
fields += layout_aggregate_members (decls, context, inherited_p);