Different fixes for d2

This commit is contained in:
Alexey Prokhin
2010-10-07 22:35:32 +04:00
parent df87607ba2
commit 4d7a6eda23
35 changed files with 443 additions and 241 deletions

View File

@@ -41,6 +41,7 @@ struct VarDeclaration;
struct dt_t;
#if IN_LLVM
class ClassInfoDeclaration;
namespace llvm
{
class Type;
@@ -251,7 +252,6 @@ struct ClassDeclaration : AggregateDeclaration
BaseClasses *vtblInterfaces; // array of base interfaces that have
// their own vtbl[]
TypeInfoClassDeclaration *vclassinfo; // the ClassInfo object for this ClassDeclaration
int com; // !=0 if this is a COM class (meaning
// it derives from IUnknown)

View File

@@ -1171,7 +1171,7 @@ Expression *AddrExp::castTo(Scope *sc, Type *t)
{ Dsymbol *s = (Dsymbol *)eo->vars->a.data[i];
FuncDeclaration *f2 = s->isFuncDeclaration();
assert(f2);
if (f2->overloadExactMatch(t->nextOf(), m))
if (f2->overloadExactMatch(t->nextOf(), m))
{ if (f)
/* Error if match in more than one overload set,
* even if one is a 'better' match than the other.
@@ -1190,7 +1190,6 @@ Expression *AddrExp::castTo(Scope *sc, Type *t)
}
}
if (type->ty == Tpointer && type->nextOf()->ty == Tfunction &&
tb->ty == Tpointer && tb->nextOf()->ty == Tfunction &&
e1->op == TOKvar)
@@ -1199,8 +1198,10 @@ Expression *AddrExp::castTo(Scope *sc, Type *t)
FuncDeclaration *f = ve->var->isFuncDeclaration();
if (f)
{
#if !IN_LLVM
assert(0); // should be SymOffExp instead
f = f->overloadExactMatch(tb->nextOf(), m);
#endif
f = f->overloadExactMatch(tb->nextOf(), m);
if (f)
{
e = new VarExp(loc, f);
@@ -1211,6 +1212,7 @@ Expression *AddrExp::castTo(Scope *sc, Type *t)
}
}
}
e = Expression::castTo(sc, t);
}
e->type = t;
@@ -1474,7 +1476,10 @@ Expression *BinExp::scaleFactor(Scope *sc)
stride = t1b->nextOf()->size(loc);
if (!t->equals(t2b))
e2 = e2->castTo(sc, t);
// LDC: llvm uses typesafe pointer arithmetic
#if !IN_LLVM
e2 = new MulExp(loc, e2, new IntegerExp(0, stride, t));
#endif
e2->type = t;
type = e1->type;
}
@@ -1489,7 +1494,9 @@ Expression *BinExp::scaleFactor(Scope *sc)
e = e1->castTo(sc, t);
else
e = e1;
#if !IN_LLVM
e = new MulExp(loc, e, new IntegerExp(0, stride, t));
#endif
e->type = t;
type = e2->type;
e1 = e2;

View File

@@ -190,11 +190,13 @@ ClassDeclaration::ClassDeclaration(Loc loc, Identifier *id, BaseClasses *basecla
classinfo = this;
}
#if !MODULEINFO_IS_STRUCT
if (id == Id::ModuleInfo)
{ if (Module::moduleinfo)
Module::moduleinfo->error("%s", msg);
Module::moduleinfo = this;
}
#endif
}
com = 0;

View File

@@ -614,7 +614,7 @@ void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (haliassym)
{
buf->writestring(haliassym->toChars());
buf->writestring(haliassym->toChars());
buf->writeByte(' ');
buf->writestring(ident->toChars());
}
@@ -626,7 +626,11 @@ void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (aliassym)
{
#if !IN_LLVM
aliassym->toCBuffer(buf, hgs);
#else
buf->writestring(aliassym->toChars());
#endif
buf->writeByte(' ');
buf->writestring(ident->toChars());
}
@@ -876,7 +880,7 @@ void VarDeclaration::semantic(Scope *sc)
//printf("declaring field %s of type %s\n", v->toChars(), v->type->toChars());
v->semantic(sc);
/*
#if !IN_LLVM
// removed for LDC since TupleDeclaration::toObj already creates the fields;
// adding them to the scope again leads to duplicates
if (sc->scopesym)
@@ -884,7 +888,7 @@ void VarDeclaration::semantic(Scope *sc)
if (sc->scopesym->members)
sc->scopesym->members->push(v);
}
*/
#endif
Expression *e = new DsymbolExp(loc, v);
exps->data[i] = e;
}

View File

@@ -450,6 +450,7 @@ struct TypeInfoClassDeclaration : TypeInfoDeclaration
#endif
#if IN_LLVM
void codegen(Ir*);
void llvmDefine();
#endif
};
@@ -618,6 +619,10 @@ struct TypeInfoSharedDeclaration : TypeInfoDeclaration
#if IN_DMD
void toDt(dt_t **pdt);
#endif
#if IN_LLVM
void llvmDefine();
#endif
};
struct TypeInfoWildDeclaration : TypeInfoDeclaration
@@ -627,6 +632,10 @@ struct TypeInfoWildDeclaration : TypeInfoDeclaration
#if IN_DMD
void toDt(dt_t **pdt);
#endif
#if IN_LLVM
void llvmDefine();
#endif
};
#endif

View File

@@ -834,12 +834,14 @@ Type *functionParameters(Loc loc, Scope *sc, TypeFunction *tf,
void expToCBuffer(OutBuffer *buf, HdrGenState *hgs, Expression *e, enum PREC pr)
{
#if !IN_LLVM
#ifdef DEBUG
if (precedence[e->op] == PREC_zero)
printf("precedence not defined for token '%s'\n",Token::tochars[e->op]);
#endif
assert(precedence[e->op] != PREC_zero);
assert(pr != PREC_zero);
#endif
//if (precedence[e->op] == 0) e->dump(0);
if (precedence[e->op] < pr ||
@@ -2489,7 +2491,7 @@ Expression *ThisExp::semantic(Scope *sc)
#if LOGSEMANTIC
printf("ThisExp::semantic()\n");
#endif
if (type)
if (type && var)
{ //assert(global.errors || var);
return this;
}
@@ -2534,7 +2536,8 @@ Expression *ThisExp::semantic(Scope *sc)
assert(fd->vthis);
var = fd->vthis;
assert(var->parent);
type = var->type;
if (!type)
type = var->type;
var->isVarDeclaration()->checkNestedReference(sc, loc);
if (!sc->intypeof)
sc->callSuper |= CSXthis;
@@ -7402,6 +7405,14 @@ Expression *AddrExp::semantic(Scope *sc)
if (f)
{
#if !IN_LLVM
if (f->isIntrinsic())
{
error("cannot take the address of intrinsic function %s", e1->toChars());
return this;
}
#endif
if (!ve->hasOverloads ||
/* Because nested functions cannot be overloaded,
* mark here that we took its address because castTo()
@@ -7789,6 +7800,9 @@ CastExp::CastExp(Loc loc, Expression *e, Type *t)
{
to = t;
this->mod = ~0;
#if IN_LLVM
disableOptimization = false;
#endif
}
#if DMDV2
@@ -7799,6 +7813,9 @@ CastExp::CastExp(Loc loc, Expression *e, unsigned mod)
{
to = NULL;
this->mod = mod;
#if IN_LLVM
disableOptimization = false;
#endif
}
#endif
@@ -7987,7 +8004,6 @@ void CastExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
expToCBuffer(buf, hgs, e1, precedence[op]);
}
/************************************************************/
SliceExp::SliceExp(Loc loc, Expression *e1, Expression *lwr, Expression *upr)

View File

@@ -1301,6 +1301,7 @@ struct CastExp : UnaExp
#if IN_LLVM
DValue* toElem(IRState* irs);
llvm::Constant *toConstElem(IRState *irs);
bool disableOptimization;
#endif
};

View File

@@ -775,7 +775,9 @@ void FuncDeclaration::semantic(Scope *sc)
Ldone:
Module::dprogress++;
semanticRun = PASSsemanticdone;
//LDC relies on semanticRun variable not being reset here
if(semanticRun < PASSsemanticdone)
semanticRun = PASSsemanticdone;
/* Save scope for possible later use (if we need the
* function internals)
@@ -1235,7 +1237,7 @@ void FuncDeclaration::semantic3(Scope *sc)
else
{ // Call invariant virtually
ThisExp *tv = new ThisExp(0);
tv->type = vthis->type;
tv->type = vthis->type;
tv->var = vthis;
Expression* v = tv;
@@ -2771,7 +2773,7 @@ FuncDeclaration *FuncDeclaration::genCfunc(Parameters *args, Type *treturn, Iden
}
else
{
tf = new TypeFunction(NULL, treturn, 0, LINKc);
tf = new TypeFunction(args, treturn, 0, LINKc);
fd = new FuncDeclaration(0, 0, id, STCstatic, tf);
fd->protection = PROTpublic;
fd->linkage = LINKc;
@@ -3011,7 +3013,7 @@ void CtorDeclaration::semantic(Scope *sc)
// to the function body
if (fbody && semanticRun < PASSsemantic)
{
Expression *e = new ThisExp(loc);
ThisExp *e = new ThisExp(loc);
if (parent->isClassDeclaration())
e->type = tret;
Statement *s = new ReturnStatement(loc, e);

View File

@@ -202,7 +202,9 @@ char *ClassDeclaration::mangle()
ident == Id::TypeInfo_Tuple ||
this == object ||
this == classinfo ||
#if !MODULEINFO_IS_STRUCT
this == Module::moduleinfo ||
#endif
memcmp(ident->toChars(), "TypeInfo_", 9) == 0
)
parent = NULL;

View File

@@ -57,7 +57,7 @@ static llvm::cl::opt<bool> fqnNames("oq",
llvm::cl::ZeroOrMore);
#endif
ClassDeclaration *Module::moduleinfo;
AggregateDeclaration *Module::moduleinfo;
Module *Module::rootModule;
DsymbolTable *Module::modules;

View File

@@ -65,8 +65,7 @@ struct Module : Package
static unsigned dprogress; // progress resolving the deferred list
static void init();
static ClassDeclaration *moduleinfo;
static AggregateDeclaration *moduleinfo;
const char *arg; // original argument name
ModuleDeclaration *md; // if !NULL, the contents of the ModuleDeclaration declaration

View File

@@ -1538,7 +1538,7 @@ Type *Type::merge()
//if (next)
//next = next->merge();
toDecoBuffer(&buf, false);
toDecoBuffer(&buf, false);
sv = stringtable.update((char *)buf.data, buf.offset);
if (sv->ptrvalue)
{ t = (Type *) sv->ptrvalue;
@@ -1556,19 +1556,19 @@ Type *Type::merge()
// we still need deco strings to be unique
// or Type::equals fails, which breaks a bunch of stuff,
// like covariant member function overloads.
OutBuffer mangle;
toDecoBuffer(&mangle, true);
StringValue* sv2 = deco_stringtable.update((char *)mangle.data, mangle.offset);
if (sv2->ptrvalue)
{ Type* t2 = (Type *) sv2->ptrvalue;
assert(t2->deco);
deco = t2->deco;
}
else
{
sv2->ptrvalue = this;
deco = (char *)sv2->lstring.string;
}
OutBuffer mangle;
toDecoBuffer(&mangle, true);
StringValue* sv2 = deco_stringtable.update((char *)mangle.data, mangle.offset);
if (sv2->ptrvalue)
{ Type* t2 = (Type *) sv2->ptrvalue;
assert(t2->deco);
deco = t2->deco;
}
else
{
sv2->ptrvalue = this;
deco = (char *)sv2->lstring.string;
}
//printf("new value, deco = '%s' %p\n", t->deco, t->deco);
}
}
@@ -1753,7 +1753,11 @@ Expression *Type::getProperty(Loc loc, Identifier *ident)
{
if (ty == Tvoid)
error(loc, "void does not have an initializer");
#if IN_LLVM
e = defaultInit(loc);
#else
e = defaultInitLiteral(loc);
#endif
}
else if (ident == Id::mangleof)
{ const char *s;
@@ -3123,26 +3127,26 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
Expression *ec;
Expressions *arguments;
//LDC: Build arguments.
static FuncDeclaration *adReverseChar_fd = NULL;
if(!adReverseChar_fd) {
Parameters* args = new Parameters;
Type* arrty = Type::tchar->arrayOf();
args->push(new Parameter(STCin, arrty, NULL, NULL));
adReverseChar_fd = FuncDeclaration::genCfunc(args, arrty, "_adReverseChar");
}
static FuncDeclaration *adReverseWchar_fd = NULL;
if(!adReverseWchar_fd) {
Parameters* args = new Parameters;
Type* arrty = Type::twchar->arrayOf();
args->push(new Parameter(STCin, arrty, NULL, NULL));
adReverseWchar_fd = FuncDeclaration::genCfunc(args, arrty, "_adReverseWchar");
}
//LDC: Build arguments.
static FuncDeclaration *adReverseChar_fd = NULL;
if(!adReverseChar_fd) {
Parameters* args = new Parameters;
Type* arrty = Type::tchar->arrayOf();
args->push(new Parameter(STCin, arrty, NULL, NULL));
adReverseChar_fd = FuncDeclaration::genCfunc(args, arrty, "_adReverseChar");
}
static FuncDeclaration *adReverseWchar_fd = NULL;
if(!adReverseWchar_fd) {
Parameters* args = new Parameters;
Type* arrty = Type::twchar->arrayOf();
args->push(new Parameter(STCin, arrty, NULL, NULL));
adReverseWchar_fd = FuncDeclaration::genCfunc(args, arrty, "_adReverseWchar");
}
if(n->ty == Twchar)
ec = new VarExp(0, adReverseWchar_fd);
else
ec = new VarExp(0, adReverseChar_fd);
if(n->ty == Twchar)
ec = new VarExp(0, adReverseWchar_fd);
else
ec = new VarExp(0, adReverseChar_fd);
e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
arguments = new Expressions();
arguments->push(e);
@@ -3154,26 +3158,26 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
Expression *ec;
Expressions *arguments;
//LDC: Build arguments.
static FuncDeclaration *adSortChar_fd = NULL;
if(!adSortChar_fd) {
Parameters* args = new Parameters;
Type* arrty = Type::tchar->arrayOf();
args->push(new Parameter(STCin, arrty, NULL, NULL));
adSortChar_fd = FuncDeclaration::genCfunc(args, arrty, "_adSortChar");
}
static FuncDeclaration *adSortWchar_fd = NULL;
if(!adSortWchar_fd) {
Parameters* args = new Parameters;
Type* arrty = Type::twchar->arrayOf();
args->push(new Parameter(STCin, arrty, NULL, NULL));
adSortWchar_fd = FuncDeclaration::genCfunc(args, arrty, "_adSortWchar");
}
//LDC: Build arguments.
static FuncDeclaration *adSortChar_fd = NULL;
if(!adSortChar_fd) {
Parameters* args = new Parameters;
Type* arrty = Type::tchar->arrayOf();
args->push(new Parameter(STCin, arrty, NULL, NULL));
adSortChar_fd = FuncDeclaration::genCfunc(args, arrty, "_adSortChar");
}
static FuncDeclaration *adSortWchar_fd = NULL;
if(!adSortWchar_fd) {
Parameters* args = new Parameters;
Type* arrty = Type::twchar->arrayOf();
args->push(new Parameter(STCin, arrty, NULL, NULL));
adSortWchar_fd = FuncDeclaration::genCfunc(args, arrty, "_adSortWchar");
}
if(n->ty == Twchar)
ec = new VarExp(0, adSortWchar_fd);
else
ec = new VarExp(0, adSortChar_fd);
if(n->ty == Twchar)
ec = new VarExp(0, adSortWchar_fd);
else
ec = new VarExp(0, adSortChar_fd);
e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
arguments = new Expressions();
arguments->push(e);
@@ -3189,37 +3193,39 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
assert(size);
dup = (ident == Id::dup || ident == Id::idup);
//LDC: Build arguments.
static FuncDeclaration *adDup_fd = NULL;
if(!adDup_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL));
args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL));
adDup_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adDup);
}
static FuncDeclaration *adReverse_fd = NULL;
if(!adReverse_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL));
args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL));
adReverse_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adReverse);
}
//LDC: Build arguments.
static FuncDeclaration *adDup_fd = NULL;
if(!adDup_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL));
args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL));
adDup_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adDup);
}
static FuncDeclaration *adReverse_fd = NULL;
if(!adReverse_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL));
args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL));
adReverse_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adReverse);
}
if(dup)
ec = new VarExp(0, adDup_fd);
else
ec = new VarExp(0, adReverse_fd);
if(dup)
ec = new VarExp(0, adDup_fd);
else
ec = new VarExp(0, adReverse_fd);
e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
arguments = new Expressions();
if (dup)
arguments->push(getTypeInfo(sc));
// LDC repaint array type to void[]
if (n->ty != Tvoid) {
e = new CastExp(e->loc, e, e->type);
e->type = Type::tvoid->arrayOf();
}
arguments->push(e);
// LDC repaint array type to void[]
if (n->ty != Tvoid) {
CastExp *exp = new CastExp(e->loc, e, e->type);
exp->type = Type::tvoid->arrayOf();
exp->disableOptimization = true;
e = exp;
}
arguments->push(e);
if (!dup)
arguments->push(new IntegerExp(0, size, Type::tsize_t));
@@ -3237,41 +3243,46 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
{
Expression *ec;
Expressions *arguments;
bool isBit = (n->ty == Tbit);
bool isBit = (n->ty == Tbit);
//LDC: Build arguments.
static FuncDeclaration *adSort_fd = NULL;
if(!adSort_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL));
args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL));
adSort_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSort");
}
static FuncDeclaration *adSortBit_fd = NULL;
if(!adSortBit_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL));
args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL));
adSortBit_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSortBit");
}
//LDC: Build arguments.
static FuncDeclaration *adSort_fd = NULL;
if(!adSort_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL));
args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL));
adSort_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSort");
}
static FuncDeclaration *adSortBit_fd = NULL;
if(!adSortBit_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL));
args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL));
adSortBit_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSortBit");
}
if(isBit)
ec = new VarExp(0, adSortBit_fd);
else
ec = new VarExp(0, adSort_fd);
if(isBit)
ec = new VarExp(0, adSortBit_fd);
else
ec = new VarExp(0, adSort_fd);
e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
arguments = new Expressions();
// LDC repaint array type to void[]
if (n->ty != Tvoid) {
e = new CastExp(e->loc, e, e->type);
e->type = Type::tvoid->arrayOf();
}
// LDC repaint array type to void[]
if (n->ty != Tvoid) {
CastExp *exp = new CastExp(e->loc, e, e->type);
exp->type = Type::tvoid->arrayOf();
exp->disableOptimization = true;
e = exp;
}
arguments->push(e);
if (next->ty != Tbit)
arguments->push(n->getTypeInfo(sc)); // LDC, we don't support the getInternalTypeInfo
// optimization arbitrarily, not yet at least...
if (next->ty != Tbit) {
// LDC, we don't support the getInternalTypeInfo
// optimization arbitrarily, not yet at least...
arguments->push(n->getTypeInfo(sc));
}
e = new CallExp(e->loc, ec, arguments);
e->type = next->arrayOf();
}
@@ -7499,9 +7510,17 @@ L1:
{ /* The handle to the monitor (call it a void*)
* *(cast(void**)e + 1)
*/
#if IN_LLVM
e = e->castTo(sc, tint8->pointerTo()->pointerTo());
e = new AddExp(e->loc, e, new IntegerExp(1));
e->type = tint8->pointerTo();
e = e->castTo(sc, tvoidptr->pointerTo());
e = new PtrExp(e->loc, e);
#else
e = e->castTo(sc, tvoidptr->pointerTo());
e = new AddExp(e->loc, e, new IntegerExp(1));
e = new PtrExp(e->loc, e);
#endif
e = e->semantic(sc);
return e;
}

View File

@@ -286,6 +286,8 @@ Expression *AddrExp::optimize(int result)
{ Expression *e;
//printf("AddrExp::optimize(result = %d) %s\n", result, toChars());
// LDC never try to interpret: it could change the semantics by turning
// const p = &s; into an something like const p = &(Struct());
/* Rewrite &(a,b) as (a,&b)
*/
@@ -295,13 +297,13 @@ Expression *AddrExp::optimize(int result)
ae->type = type;
e = new CommaExp(ce->loc, ce->e1, ae);
e->type = type;
return e->optimize(result);
return e->optimize(result & ~WANTinterpret);
}
if (e1->op == TOKvar)
{ VarExp *ve = (VarExp *)e1;
if (ve->var->storage_class & STCmanifest)
e1 = e1->optimize(result);
e1 = e1->optimize(result & ~WANTinterpret);
}
else
e1 = e1->optimize(result);
@@ -523,6 +525,10 @@ Expression *CallExp::optimize(int result)
Expression *CastExp::optimize(int result)
{
#if IN_LLVM
if (disableOptimization)
return this;
#endif
//printf("CastExp::optimize(result = %d) %s\n", result, toChars());
//printf("from %s to %s\n", type->toChars(), to->toChars());
//printf("from %s\n", type->toChars());
@@ -551,6 +557,9 @@ Expression *CastExp::optimize(int result)
e1->type->nextOf()->size() == type->nextOf()->size()
)
{
// LDC make a copy before adjusting type to avoid
// messing up the type of an existing initializer
e1 = e1->syntaxCopy();
Expression *e = e1->castTo(NULL, type);
if (X) printf(" returning1 %s\n", e->toChars());
return e;

View File

@@ -32,6 +32,7 @@ AggregateDeclaration::AggregateDeclaration(Loc loc, Identifier *id)
protection = PROTpublic;
type = NULL;
handle = NULL;
scope = 0;
structsize = 0; // size of struct
alignsize = 0; // size of struct for alignment purposes
structalign = 0; // struct member alignment in effect
@@ -263,6 +264,15 @@ StructDeclaration::StructDeclaration(Loc loc, Identifier *id)
// For forward references
type = new TypeStruct(this);
#if MODULEINFO_IS_STRUCT
if (id == Id::ModuleInfo)
{
if (Module::moduleinfo)
Module::moduleinfo->error("only object.d can define this reserved class name");
Module::moduleinfo = this;
}
#endif
}
Dsymbol *StructDeclaration::syntaxCopy(Dsymbol *s)