From d3da83f66f13d371f8bb73443fed32d5c820484d Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Fri, 5 Jun 2020 11:37:47 +0200 Subject: [PATCH] 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. --- gcc/d/d-builtins.cc | 2 +- gcc/d/decl.cc | 2 +- gcc/d/dmd/MERGE | 2 +- gcc/d/dmd/attrib.c | 50 +++++++++++++++++++-------------------- gcc/d/dmd/attrib.h | 8 +++---- gcc/d/dmd/canthrow.c | 2 +- gcc/d/dmd/cond.c | 7 +++--- gcc/d/dmd/cond.h | 8 +++---- gcc/d/dmd/doc.c | 4 ++-- gcc/d/dmd/dscope.c | 2 -- gcc/d/dmd/dsymbol.c | 2 +- gcc/d/dmd/expressionsem.c | 6 +---- gcc/d/dmd/json.c | 2 +- gcc/d/dmd/scope.h | 2 -- gcc/d/dmd/statement.c | 8 +++---- gcc/d/dmd/statementsem.c | 2 +- gcc/d/dmd/traits.c | 2 +- gcc/d/types.cc | 2 +- 18 files changed, 52 insertions(+), 61 deletions(-) diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc index c18287a2025..61014cbea51 100644 --- a/gcc/d/d-builtins.cc +++ b/gcc/d/d-builtins.cc @@ -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++) diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index 11e66483b8f..d5f8797b55e 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -232,7 +232,7 @@ public: void visit (AttribDeclaration *d) { - Dsymbols *ds = d->include (NULL, NULL); + Dsymbols *ds = d->include (NULL); if (!ds) return; diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index a742bd096fa..0a4fb767396 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -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. diff --git a/gcc/d/dmd/attrib.c b/gcc/d/dmd/attrib.c index 6f176ef096d..02761ab0355 100644 --- a/gcc/d/dmd/attrib.c +++ b/gcc/d/dmd/attrib.c @@ -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; diff --git a/gcc/d/dmd/attrib.h b/gcc/d/dmd/attrib.h index b7432e0f80a..a20e96bc929 100644 --- a/gcc/d/dmd/attrib.h +++ b/gcc/d/dmd/attrib.h @@ -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); diff --git a/gcc/d/dmd/canthrow.c b/gcc/d/dmd/canthrow.c index 1e1fa58703d..33d61edbcc8 100644 --- a/gcc/d/dmd/canthrow.c +++ b/gcc/d/dmd/canthrow.c @@ -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++) diff --git a/gcc/d/dmd/cond.c b/gcc/d/dmd/cond.c index 8c97b2a1b4f..88febdf5e1e 100644 --- a/gcc/d/dmd/cond.c +++ b/gcc/d/dmd/cond.c @@ -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); diff --git a/gcc/d/dmd/cond.h b/gcc/d/dmd/cond.h index 09ab28af1df..c32f7bba5e6 100644 --- a/gcc/d/dmd/cond.h +++ b/gcc/d/dmd/cond.h @@ -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); } }; diff --git a/gcc/d/dmd/doc.c b/gcc/d/dmd/doc.c index a448e342a82..7c21ab2efe7 100644 --- a/gcc/d/dmd/doc.c +++ b/gcc/d/dmd/doc.c @@ -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++) diff --git a/gcc/d/dmd/dscope.c b/gcc/d/dmd/dscope.c index f1b7f2d9a65..a5d56b2e4a7 100644 --- a/gcc/d/dmd/dscope.c +++ b/gcc/d/dmd/dscope.c @@ -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; diff --git a/gcc/d/dmd/dsymbol.c b/gcc/d/dmd/dsymbol.c index f8b063f0318..f835192fe34 100644 --- a/gcc/d/dmd/dsymbol.c +++ b/gcc/d/dmd/dsymbol.c @@ -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()) diff --git a/gcc/d/dmd/expressionsem.c b/gcc/d/dmd/expressionsem.c index 048752dc23b..cec57d4a8e6 100644 --- a/gcc/d/dmd/expressionsem.c +++ b/gcc/d/dmd/expressionsem.c @@ -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); } diff --git a/gcc/d/dmd/json.c b/gcc/d/dmd/json.c index ba0cc6f300a..20e8c426a7f 100644 --- a/gcc/d/dmd/json.c +++ b/gcc/d/dmd/json.c @@ -596,7 +596,7 @@ public: void visit(AttribDeclaration *d) { - Dsymbols *ds = d->include(NULL, NULL); + Dsymbols *ds = d->include(NULL); if (ds) { diff --git a/gcc/d/dmd/scope.h b/gcc/d/dmd/scope.h index 950264608b1..7456f7098f6 100644 --- a/gcc/d/dmd/scope.h +++ b/gcc/d/dmd/scope.h @@ -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 diff --git a/gcc/d/dmd/statement.c b/gcc/d/dmd/statement.c index da305f465c9..b0daed514b7 100644 --- a/gcc/d/dmd/statement.c +++ b/gcc/d/dmd/statement.c @@ -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) diff --git a/gcc/d/dmd/statementsem.c b/gcc/d/dmd/statementsem.c index aac1c3094c8..3186db7e2a4 100644 --- a/gcc/d/dmd/statementsem.c +++ b/gcc/d/dmd/statementsem.c @@ -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) diff --git a/gcc/d/dmd/traits.c b/gcc/d/dmd/traits.c index c38a4abdb49..46cacf3e4c5 100644 --- a/gcc/d/dmd/traits.c +++ b/gcc/d/dmd/traits.c @@ -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); } } diff --git a/gcc/d/types.cc b/gcc/d/types.cc index 1f43352885a..e8073b860fa 100644 --- a/gcc/d/types.cc +++ b/gcc/d/types.cc @@ -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); -- 2.30.2