diff --git a/src/dmd/aggregate.h b/src/dmd/aggregate.h index d5e56914b72e..dcd564b57047 100644 --- a/src/dmd/aggregate.h +++ b/src/dmd/aggregate.h @@ -95,6 +95,7 @@ class AggregateDeclaration : public ScopeDsymbol */ Dsymbol *enclosing; VarDeclaration *vthis; // 'this' parameter if this aggregate is nested + VarDeclaration *vthis2; // 'this' parameter if this aggregate is a template and is nested // Special member functions FuncDeclarations invs; // Array of invariants FuncDeclaration *inv; // invariant @@ -121,6 +122,7 @@ class AggregateDeclaration : public ScopeDsymbol virtual Scope *newScope(Scope *sc); void setScope(Scope *sc); bool determineFields(); + size_t nonHiddenFields(); bool determineSize(Loc loc); virtual void finalizeSize() = 0; d_uns64 size(const Loc &loc); @@ -129,6 +131,7 @@ class AggregateDeclaration : public ScopeDsymbol bool isDeprecated() const; // is aggregate deprecated? bool isNested() const; void makeNested(); + void makeNested2(); bool isExport() const; Dsymbol *searchCtor(); diff --git a/src/dmd/declaration.h b/src/dmd/declaration.h index 1f2a87b9216c..bfddea1c3421 100644 --- a/src/dmd/declaration.h +++ b/src/dmd/declaration.h @@ -461,6 +461,7 @@ class FuncDeclaration : public Declaration struct HiddenParameters { VarDeclaration *this_; + bool isThis2; VarDeclaration *selector; }; @@ -486,6 +487,7 @@ class FuncDeclaration : public Declaration // scopes from having the same name DsymbolTable *localsymtab; VarDeclaration *vthis; // 'this' parameter (member and nested) + bool isThis2; // has a dual-context 'this' parameter VarDeclaration *v_arguments; // '_arguments' parameter ObjcSelector *selector; // Objective-C method selector (member function only) VarDeclaration *selectorParameter; // Objective-C implicit selector parameter diff --git a/src/dmd/dsymbol.h b/src/dmd/dsymbol.h index 0ef1df8fcfe2..f6f07c577e98 100644 --- a/src/dmd/dsymbol.h +++ b/src/dmd/dsymbol.h @@ -177,7 +177,6 @@ class Dsymbol : public ASTNode Module *getModule(); Module *getAccessModule(); Dsymbol *pastMixin(); - Dsymbol *pastMixinAndNspace(); Dsymbol *toParent(); Dsymbol *toParent2(); Dsymbol *toParent3(); @@ -278,8 +277,10 @@ class Dsymbol : public ASTNode virtual SymbolDeclaration *isSymbolDeclaration() { return NULL; } virtual AttribDeclaration *isAttribDeclaration() { return NULL; } virtual AnonDeclaration *isAnonDeclaration() { return NULL; } + virtual CPPNamespaceDeclaration *isCPPNamespaceDeclaration() { return NULL; } virtual ProtDeclaration *isProtDeclaration() { return NULL; } virtual OverloadSet *isOverloadSet() { return NULL; } + virtual CompileDeclaration *isCompileDeclaration() { return NULL; } void accept(Visitor *v) { v->visit(this); } }; diff --git a/src/dmd/expression.h b/src/dmd/expression.h index bf685d7e11d1..ea8efa54e0e1 100644 --- a/src/dmd/expression.h +++ b/src/dmd/expression.h @@ -551,6 +551,7 @@ class SymbolExp : public Expression public: Declaration *var; bool hasOverloads; + Dsymbol *originalScope; void accept(Visitor *v) { v->visit(this); } }; @@ -785,6 +786,7 @@ class DelegateExp : public UnaExp public: FuncDeclaration *func; bool hasOverloads; + VarDeclaration *vthis2; // container for multi-context void accept(Visitor *v) { v->visit(this); } @@ -804,6 +806,7 @@ class CallExp : public UnaExp Expressions *arguments; // function arguments FuncDeclaration *f; // symbol to call bool directcall; // true if a virtual call is devirtualized + VarDeclaration *vthis2; // container for multi-context static CallExp *create(Loc loc, Expression *e, Expressions *exps); static CallExp *create(Loc loc, Expression *e); diff --git a/src/dmd/hdrgen.d b/src/dmd/hdrgen.d index 52b0780ceb61..1b582875c005 100644 --- a/src/dmd/hdrgen.d +++ b/src/dmd/hdrgen.d @@ -2123,7 +2123,7 @@ public: override void visit(SymOffExp e) { if (e.offset) - buf.printf("(& %s+%u)", e.var.toChars(), e.offset); + buf.printf("(& %s%+lld)", e.var.toChars(), e.offset); else if (e.var.isTypeInfoDeclaration()) buf.writestring(e.var.toChars()); else diff --git a/src/dmd/module.h b/src/dmd/module.h index 3d46b995c704..44eb15fac583 100644 --- a/src/dmd/module.h +++ b/src/dmd/module.h @@ -15,6 +15,7 @@ struct ModuleDeclaration; struct Macro; struct Escape; +struct FileBuffer; enum PKG { diff --git a/src/dmd/mtype.h b/src/dmd/mtype.h index 31dcd7d899d8..45e9066e7161 100644 --- a/src/dmd/mtype.h +++ b/src/dmd/mtype.h @@ -252,6 +252,7 @@ class Type : public ASTNode virtual bool iscomplex(); virtual bool isscalar(); virtual bool isunsigned(); + virtual bool ischar(); virtual bool isscope(); virtual bool isString(); virtual bool isAssignable(); diff --git a/src/dmd/root/outbuffer.h b/src/dmd/root/outbuffer.h index bafa2df0ed4d..fb340cee310b 100644 --- a/src/dmd/root/outbuffer.h +++ b/src/dmd/root/outbuffer.h @@ -71,7 +71,7 @@ struct OutBuffer size_t insert(size_t offset, const void *data, size_t nbytes); void remove(size_t offset, size_t nbytes); // Append terminating null if necessary and get view of internal buffer - char *peekString(); + char *peekChars(); // Append terminating null if necessary and take ownership of data - char *extractString(); + char *extractChars(); }; diff --git a/src/tests/cxxfrontend.c b/src/tests/cxxfrontend.c index 44e6cedc6782..4367ccf329d2 100644 --- a/src/tests/cxxfrontend.c +++ b/src/tests/cxxfrontend.c @@ -171,31 +171,43 @@ void test_visitors() assert(tv.idexpr == true); Module *mod = Module::create("test", ident, 0, 0); + assert(mod->isModule() == mod); mod->accept(&tv); assert(tv.package == true); ExpStatement *es = ExpStatement::create(loc, ie); + assert(es->isExpStatement() == es); es->accept(&tv); assert(tv.stmt == true); TypePointer *tp = TypePointer::create(Type::tvoid); + assert(tp->hasPointers() == true); tp->accept(&tv); assert(tv.type == true); LinkDeclaration *ld = LinkDeclaration::create(LINKd, NULL); + assert(ld->isAttribDeclaration() == static_cast(ld)); + assert(ld->linkage == LINKd); ld->accept(&tv); assert(tv.attrib == true); ClassDeclaration *cd = ClassDeclaration::create(loc, Identifier::idPool("TypeInfo"), NULL, NULL, true); + assert(cd->isClassDeclaration() == cd); + assert(cd->vtblOffset() == 1); cd->accept(&tv); - assert(tv.aggr = true); + assert(tv.aggr == true); AliasDeclaration *ad = AliasDeclaration::create(loc, ident, tp); + assert(ad->isAliasDeclaration() == ad); + ad->storage_class = STCabstract; + assert(ad->isAbstract() == true); ad->accept(&tv); assert(tv.decl == true); cd = ClassDeclaration::create(loc, Identifier::idPool("TypeInfo_Pointer"), NULL, NULL, true); TypeInfoPointerDeclaration *ti = TypeInfoPointerDeclaration::create(tp); + assert(ti->isTypeInfoDeclaration() == ti); + assert(ti->tinfo == tp); ti->accept(&tv); assert(tv.typeinfo == true); }