mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-28 01:23:14 +01:00
Merge dmd-1.073.
This commit is contained in:
28
dmd/struct.c
28
dmd/struct.c
@@ -54,6 +54,7 @@ AggregateDeclaration::AggregateDeclaration(Loc loc, Identifier *id)
|
||||
aliasthis = NULL;
|
||||
noDefaultCtor = FALSE;
|
||||
#endif
|
||||
dtor = NULL;
|
||||
|
||||
#if IN_LLVM
|
||||
availableExternally = true; // assume this unless proven otherwise
|
||||
@@ -77,7 +78,7 @@ void AggregateDeclaration::semantic2(Scope *sc)
|
||||
sc = sc->push(this);
|
||||
for (size_t i = 0; i < members->dim; i++)
|
||||
{
|
||||
Dsymbol *s = (Dsymbol *)members->data[i];
|
||||
Dsymbol *s = members->tdata()[i];
|
||||
s->semantic2(sc);
|
||||
}
|
||||
sc->pop();
|
||||
@@ -96,7 +97,7 @@ void AggregateDeclaration::semantic3(Scope *sc)
|
||||
sc = sc->push(this);
|
||||
for (size_t i = 0; i < members->dim; i++)
|
||||
{
|
||||
Dsymbol *s = (Dsymbol *)members->data[i];
|
||||
Dsymbol *s = members->tdata()[i];
|
||||
s->semantic3(sc);
|
||||
}
|
||||
sc->pop();
|
||||
@@ -110,7 +111,7 @@ void AggregateDeclaration::inlineScan()
|
||||
{
|
||||
for (size_t i = 0; i < members->dim; i++)
|
||||
{
|
||||
Dsymbol *s = (Dsymbol *)members->data[i];
|
||||
Dsymbol *s = members->tdata()[i];
|
||||
//printf("inline scan aggregate symbol '%s'\n", s->toChars());
|
||||
s->inlineScan();
|
||||
}
|
||||
@@ -141,6 +142,11 @@ int AggregateDeclaration::isDeprecated()
|
||||
return isdeprecated;
|
||||
}
|
||||
|
||||
int AggregateDeclaration::isExport()
|
||||
{
|
||||
return protection == PROTexport;
|
||||
}
|
||||
|
||||
/****************************
|
||||
* Do byte or word alignment as necessary.
|
||||
* Align sizes of 0, as we may not know array sizes yet.
|
||||
@@ -238,13 +244,13 @@ int AggregateDeclaration::firstFieldInUnion(int indx)
|
||||
{
|
||||
if (isUnionDeclaration())
|
||||
return 0;
|
||||
VarDeclaration * vd = (VarDeclaration *)fields.data[indx];
|
||||
VarDeclaration * vd = fields.tdata()[indx];
|
||||
int firstNonZero = indx; // first index in the union with non-zero size
|
||||
for (; ;)
|
||||
{
|
||||
if (indx == 0)
|
||||
return firstNonZero;
|
||||
VarDeclaration * v = (VarDeclaration *)fields.data[indx - 1];
|
||||
VarDeclaration * v = fields.tdata()[indx - 1];
|
||||
if (v->offset != vd->offset)
|
||||
return firstNonZero;
|
||||
--indx;
|
||||
@@ -263,7 +269,7 @@ int AggregateDeclaration::firstFieldInUnion(int indx)
|
||||
*/
|
||||
int AggregateDeclaration::numFieldsInUnion(int firstIndex)
|
||||
{
|
||||
VarDeclaration * vd = (VarDeclaration *)fields.data[firstIndex];
|
||||
VarDeclaration * vd = fields.tdata()[firstIndex];
|
||||
/* If it is a zero-length field, AND we can't find an earlier non-zero
|
||||
* sized field with the same offset, we assume it's not part of a union.
|
||||
*/
|
||||
@@ -273,7 +279,7 @@ int AggregateDeclaration::numFieldsInUnion(int firstIndex)
|
||||
int count = 1;
|
||||
for (size_t i = firstIndex+1; i < fields.dim; ++i)
|
||||
{
|
||||
VarDeclaration * v = (VarDeclaration *)fields.data[i];
|
||||
VarDeclaration * v = fields.tdata()[i];
|
||||
// If offsets are different, they are not in the same union
|
||||
if (v->offset != vd->offset)
|
||||
break;
|
||||
@@ -366,7 +372,7 @@ void StructDeclaration::semantic(Scope *sc)
|
||||
{
|
||||
for (size_t i = 0; i < members->dim; i++)
|
||||
{
|
||||
Dsymbol *s = (Dsymbol *)members->data[i];
|
||||
Dsymbol *s = members->tdata()[i];
|
||||
//printf("adding member '%s' to '%s'\n", s->toChars(), this->toChars());
|
||||
s->addMember(sc, this, 1);
|
||||
}
|
||||
@@ -387,7 +393,7 @@ void StructDeclaration::semantic(Scope *sc)
|
||||
* resolve individual members like enums.
|
||||
*/
|
||||
for (size_t i = 0; i < members_dim; i++)
|
||||
{ Dsymbol *s = (Dsymbol *)members->data[i];
|
||||
{ Dsymbol *s = members->tdata()[i];
|
||||
/* There are problems doing this in the general case because
|
||||
* Scope keeps track of things like 'offset'
|
||||
*/
|
||||
@@ -400,7 +406,7 @@ void StructDeclaration::semantic(Scope *sc)
|
||||
|
||||
for (size_t i = 0; i < members_dim; i++)
|
||||
{
|
||||
Dsymbol *s = (Dsymbol *)members->data[i];
|
||||
Dsymbol *s = members->tdata()[i];
|
||||
s->semantic(sc2);
|
||||
#if 0
|
||||
if (sizeok == 2)
|
||||
@@ -588,7 +594,7 @@ void StructDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
|
||||
buf->writenl();
|
||||
for (size_t i = 0; i < members->dim; i++)
|
||||
{
|
||||
Dsymbol *s = (Dsymbol *)members->data[i];
|
||||
Dsymbol *s = members->tdata()[i];
|
||||
|
||||
buf->writestring(" ");
|
||||
s->toCBuffer(buf, hgs);
|
||||
|
||||
Reference in New Issue
Block a user