diff options
Diffstat (limited to 'gcc/d/dmd/attrib.d')
-rw-r--r-- | gcc/d/dmd/attrib.d | 139 |
1 files changed, 27 insertions, 112 deletions
diff --git a/gcc/d/dmd/attrib.d b/gcc/d/dmd/attrib.d index df04ed1..80e8878 100644 --- a/gcc/d/dmd/attrib.d +++ b/gcc/d/dmd/attrib.d @@ -57,18 +57,19 @@ extern (C++) abstract class AttribDeclaration : Dsymbol extern (D) this(Dsymbols* decl) @safe { + super(DSYM.attribDeclaration); this.decl = decl; } extern (D) this(Loc loc, Dsymbols* decl) @safe { - super(loc, null); + super(DSYM.attribDeclaration, loc, null); this.decl = decl; } extern (D) this(Loc loc, Identifier ident, Dsymbols* decl) @safe { - super(loc, ident); + super(DSYM.attribDeclaration, loc, ident); this.decl = decl; } @@ -78,7 +79,7 @@ extern (C++) abstract class AttribDeclaration : Dsymbol * If the returned scope != sc, the caller should pop * the scope after it used. */ - extern (D) static Scope* createNewScope(Scope* sc, StorageClass stc, LINK linkage, + extern (D) static Scope* createNewScope(Scope* sc, STC stc, LINK linkage, CPPMANGLE cppmangle, Visibility visibility, int explicitVisibility, AlignDeclaration aligndecl, PragmaDeclaration inlining) { @@ -109,22 +110,11 @@ extern (C++) abstract class AttribDeclaration : Dsymbol return "attribute"; } - override bool oneMember(out Dsymbol ps, Identifier ident) - { - Dsymbols* d = this.include(null); - return Dsymbol.oneMembers(d, ps, ident); - } - override final bool hasPointers() { return this.include(null).foreachDsymbol( (s) { return s.hasPointers(); } ) != 0; } - override final bool hasStaticCtorOrDtor() - { - return this.include(null).foreachDsymbol( (s) { return s.hasStaticCtorOrDtor(); } ) != 0; - } - /**************************************** */ override final void addObjcSymbols(ClassDeclarations* classes, ClassDeclarations* categories) @@ -132,11 +122,6 @@ extern (C++) abstract class AttribDeclaration : Dsymbol objc.addSymbols(this, classes, categories); } - override inout(AttribDeclaration) isAttribDeclaration() inout pure @safe - { - return this; - } - override void accept(Visitor v) { v.visit(this); @@ -150,18 +135,20 @@ extern (C++) abstract class AttribDeclaration : Dsymbol */ extern (C++) class StorageClassDeclaration : AttribDeclaration { - StorageClass stc; + STC stc; - extern (D) this(StorageClass stc, Dsymbols* decl) @safe + extern (D) this(STC stc, Dsymbols* decl) @safe { super(decl); this.stc = stc; + this.dsym = DSYM.storageClassDeclaration; } - extern (D) this(Loc loc, StorageClass stc, Dsymbols* decl) @safe + extern (D) this(Loc loc, STC stc, Dsymbols* decl) @safe { super(loc, decl); this.stc = stc; + this.dsym = DSYM.storageClassDeclaration; } override StorageClassDeclaration syntaxCopy(Dsymbol s) @@ -170,37 +157,6 @@ extern (C++) class StorageClassDeclaration : AttribDeclaration return new StorageClassDeclaration(stc, Dsymbol.arraySyntaxCopy(decl)); } - override final bool oneMember(out Dsymbol ps, Identifier ident) - { - bool t = Dsymbol.oneMembers(decl, ps, ident); - if (t && ps) - { - /* This is to deal with the following case: - * struct Tick { - * template to(T) { const T to() { ... } } - * } - * For eponymous function templates, the 'const' needs to get attached to 'to' - * before the semantic analysis of 'to', so that template overloading based on the - * 'this' pointer can be successful. - */ - if (FuncDeclaration fd = ps.isFuncDeclaration()) - { - /* Use storage_class2 instead of storage_class otherwise when we do .di generation - * we'll wind up with 'const const' rather than 'const'. - */ - /* Don't think we need to worry about mutually exclusive storage classes here - */ - fd.storage_class2 |= stc; - } - } - return t; - } - - override inout(StorageClassDeclaration) isStorageClassDeclaration() inout - { - return this; - } - override void accept(Visitor v) { v.visit(this); @@ -253,6 +209,7 @@ extern (C++) final class LinkDeclaration : AttribDeclaration super(loc, null, decl); //printf("LinkDeclaration(linkage = %d, decl = %p)\n", linkage, decl); this.linkage = linkage; + this.dsym = DSYM.linkDeclaration; } static LinkDeclaration create(Loc loc, LINK p, Dsymbols* decl) @safe @@ -289,6 +246,7 @@ extern (C++) final class CPPMangleDeclaration : AttribDeclaration super(loc, null, decl); //printf("CPPMangleDeclaration(cppmangle = %d, decl = %p)\n", cppmangle, decl); this.cppmangle = cppmangle; + this.dsym = DSYM.cppMangleDeclaration; } override CPPMangleDeclaration syntaxCopy(Dsymbol s) @@ -334,11 +292,13 @@ extern (C++) final class CPPNamespaceDeclaration : AttribDeclaration extern (D) this(Loc loc, Identifier ident, Dsymbols* decl) @safe { super(loc, ident, decl); + this.dsym = DSYM.cppNamespaceDeclaration; } extern (D) this(Loc loc, Expression exp, Dsymbols* decl) @safe { super(loc, null, decl); + this.dsym = DSYM.cppNamespaceDeclaration; this.exp = exp; } @@ -346,6 +306,7 @@ extern (C++) final class CPPNamespaceDeclaration : AttribDeclaration CPPNamespaceDeclaration parent) @safe { super(loc, ident, decl); + this.dsym = DSYM.cppNamespaceDeclaration; this.exp = exp; this.cppnamespace = parent; } @@ -361,8 +322,6 @@ extern (C++) final class CPPNamespaceDeclaration : AttribDeclaration { v.visit(this); } - - override inout(CPPNamespaceDeclaration) isCPPNamespaceDeclaration() inout { return this; } } /*********************************************************** @@ -385,6 +344,7 @@ extern (C++) final class VisibilityDeclaration : AttribDeclaration extern (D) this(Loc loc, Visibility visibility, Dsymbols* decl) @safe { super(loc, null, decl); + this.dsym = DSYM.visibilityDeclaration; this.visibility = visibility; //printf("decl = %p\n", decl); } @@ -398,6 +358,7 @@ extern (C++) final class VisibilityDeclaration : AttribDeclaration extern (D) this(Loc loc, Identifier[] pkg_identifiers, Dsymbols* decl) { super(loc, null, decl); + this.dsym = DSYM.visibilityDeclaration; this.visibility.kind = Visibility.Kind.package_; this.pkg_identifiers = pkg_identifiers; if (pkg_identifiers.length > 0) @@ -431,11 +392,6 @@ extern (C++) final class VisibilityDeclaration : AttribDeclaration return buf.extractChars(); } - override inout(VisibilityDeclaration) isVisibilityDeclaration() inout - { - return this; - } - override void accept(Visitor v) { v.visit(this); @@ -460,6 +416,7 @@ extern (C++) final class AlignDeclaration : AttribDeclaration extern (D) this(Loc loc, Expression exp, Dsymbols* decl) { super(loc, null, decl); + this.dsym = DSYM.alignDeclaration; if (exp) { exps = new Expressions(); @@ -470,12 +427,14 @@ extern (C++) final class AlignDeclaration : AttribDeclaration extern (D) this(Loc loc, Expressions* exps, Dsymbols* decl) @safe { super(loc, null, decl); + this.dsym = DSYM.alignDeclaration; this.exps = exps; } extern (D) this(Loc loc, structalign_t salign, Dsymbols* decl) @safe { super(loc, null, decl); + this.dsym = DSYM.alignDeclaration; this.salign = salign; } @@ -507,6 +466,7 @@ extern (C++) final class AnonDeclaration : AttribDeclaration extern (D) this(Loc loc, bool isunion, Dsymbols* decl) @safe { super(loc, null, decl); + this.dsym = DSYM.anonDeclaration; this.isunion = isunion; } @@ -521,11 +481,6 @@ extern (C++) final class AnonDeclaration : AttribDeclaration return (isunion ? "anonymous union" : "anonymous struct"); } - override inout(AnonDeclaration) isAnonDeclaration() inout - { - return this; - } - override void accept(Visitor v) { v.visit(this); @@ -545,6 +500,7 @@ extern (C++) final class PragmaDeclaration : AttribDeclaration extern (D) this(Loc loc, Identifier ident, Expressions* args, Dsymbols* decl) @safe { super(loc, ident, decl); + this.dsym = DSYM.pragmaDeclaration; this.args = args; } @@ -580,6 +536,7 @@ extern (C++) class ConditionalDeclaration : AttribDeclaration extern (D) this(Loc loc, Condition condition, Dsymbols* decl, Dsymbols* elsedecl) @safe { super(loc, null, decl); + this.dsym = DSYM.conditionalDeclaration; //printf("ConditionalDeclaration::ConditionalDeclaration()\n"); this.condition = condition; this.elsedecl = elsedecl; @@ -591,22 +548,6 @@ extern (C++) class ConditionalDeclaration : AttribDeclaration return new ConditionalDeclaration(loc, condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl)); } - override final bool oneMember(out Dsymbol ps, Identifier ident) - { - //printf("ConditionalDeclaration::oneMember(), inc = %d\n", condition.inc); - if (condition.inc != Include.notComputed) - { - Dsymbols* d = condition.include(null) ? decl : elsedecl; - return Dsymbol.oneMembers(d, ps, ident); - } - else - { - bool res = (Dsymbol.oneMembers(decl, ps, ident) && ps is null && Dsymbol.oneMembers(elsedecl, ps, ident) && ps is null); - ps = null; - return res; - } - } - override void accept(Visitor v) { v.visit(this); @@ -627,6 +568,7 @@ extern (C++) final class StaticIfDeclaration : ConditionalDeclaration extern (D) this(Loc loc, Condition condition, Dsymbols* decl, Dsymbols* elsedecl) @safe { super(loc, condition, decl, elsedecl); + this.dsym = DSYM.staticIfDeclaration; //printf("StaticIfDeclaration::StaticIfDeclaration()\n"); } @@ -641,11 +583,6 @@ extern (C++) final class StaticIfDeclaration : ConditionalDeclaration return "static if"; } - override inout(StaticIfDeclaration) isStaticIfDeclaration() inout pure @safe - { - return this; - } - override void accept(Visitor v) { v.visit(this); @@ -676,6 +613,7 @@ extern (C++) final class StaticForeachDeclaration : AttribDeclaration extern (D) this(StaticForeach sfe, Dsymbols* decl) @safe { super(sfe.loc, null, decl); + this.dsym = DSYM.staticForeachDeclaration; this.sfe = sfe; } @@ -687,21 +625,6 @@ extern (C++) final class StaticForeachDeclaration : AttribDeclaration Dsymbol.arraySyntaxCopy(decl)); } - override bool oneMember(out Dsymbol ps, Identifier ident) - { - // Required to support IFTI on a template that contains a - // `static foreach` declaration. `super.oneMember` calls - // include with a `null` scope. As `static foreach` requires - // the scope for expansion, `oneMember` can only return a - // precise result once `static foreach` has been expanded. - if (cached) - { - return super.oneMember(ps, ident); - } - ps = null; // a `static foreach` declaration may in general expand to multiple symbols - return false; - } - override const(char)* kind() const { return "static foreach"; @@ -746,16 +669,11 @@ extern(C++) final class ForwardingAttribDeclaration : AttribDeclaration this(Dsymbols* decl) @safe { super(decl); + this.dsym = DSYM.forwardingAttribDeclaration; sym = new ForwardingScopeDsymbol(); sym.symtab = new DsymbolTable(); } - - override inout(ForwardingAttribDeclaration) isForwardingAttribDeclaration() inout - { - return this; - } - override void accept(Visitor v) { v.visit(this); @@ -778,6 +696,7 @@ extern (C++) final class MixinDeclaration : AttribDeclaration { super(loc, null, null); //printf("MixinDeclaration(loc = %d)\n", loc.linnum); + this.dsym = DSYM.mixinDeclaration; this.exps = exps; } @@ -792,11 +711,6 @@ extern (C++) final class MixinDeclaration : AttribDeclaration return "mixin"; } - override inout(MixinDeclaration) isMixinDeclaration() inout - { - return this; - } - override void accept(Visitor v) { v.visit(this); @@ -815,6 +729,7 @@ extern (C++) final class UserAttributeDeclaration : AttribDeclaration extern (D) this(Expressions* atts, Dsymbols* decl) @safe { super(decl); + this.dsym = DSYM.userAttributeDeclaration; this.atts = atts; } |