Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/dmd/aggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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();

Expand Down
2 changes: 2 additions & 0 deletions src/dmd/declaration.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ class FuncDeclaration : public Declaration
struct HiddenParameters
{
VarDeclaration *this_;
bool isThis2;
VarDeclaration *selector;
};

Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/dmd/dsymbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ class Dsymbol : public ASTNode
Module *getModule();
Module *getAccessModule();
Dsymbol *pastMixin();
Dsymbol *pastMixinAndNspace();
Dsymbol *toParent();
Dsymbol *toParent2();
Dsymbol *toParent3();
Expand Down Expand Up @@ -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); }
};

Expand Down
3 changes: 3 additions & 0 deletions src/dmd/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ class SymbolExp : public Expression
public:
Declaration *var;
bool hasOverloads;
Dsymbol *originalScope;

void accept(Visitor *v) { v->visit(this); }
};
Expand Down Expand Up @@ -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); }
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/hdrgen.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/dmd/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
struct ModuleDeclaration;
struct Macro;
struct Escape;
struct FileBuffer;

enum PKG
{
Expand Down
1 change: 1 addition & 0 deletions src/dmd/mtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/dmd/root/outbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
14 changes: 13 additions & 1 deletion src/tests/cxxfrontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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<AttribDeclaration *>(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);
}
Expand Down