Remove VarDeclaration::aggrIndex

This commit is contained in:
Alexey Prokhin 2014-09-22 15:20:13 +04:00
parent a0b9f95869
commit caa2f15c8a
8 changed files with 22 additions and 25 deletions

View file

@ -946,8 +946,6 @@ VarDeclaration::VarDeclaration(Loc loc, Type *type, Identifier *id, Initializer
edtor = NULL;
range = NULL;
#if IN_LLVM
aggrIndex = 0;
nakedUse = false;
#endif
}

View file

@ -348,10 +348,6 @@ public:
void accept(Visitor *v) { v->visit(this); }
#if IN_LLVM
/// Index into parent aggregate.
/// Set during type generation.
unsigned aggrIndex;
/// This var is used by a naked function.
bool nakedUse;

View file

@ -60,11 +60,11 @@ void DtoResolveClass(ClassDeclaration* cd)
I != E; ++I)
{
VarDeclaration* vd = *I;
if (!isIrFieldCreated(vd))
getIrField(vd, true);
else
IF_LOG Logger::println("class field already exists!!!");
IF_LOG {
if (isIrFieldCreated(vd))
Logger::println("class field already exists");
}
getIrField(vd, true);
}
// emit the interfaceInfosZ symbol if necessary

View file

@ -61,7 +61,10 @@ void DtoResolveStruct(StructDeclaration* sd, Loc& callerLoc)
I != E; ++I)
{
VarDeclaration *vd = *I;
assert(!isIrFieldCreated(vd));
IF_LOG {
if (isIrFieldCreated(vd))
Logger::println("struct field already exists");
}
getIrField(vd, true);
}
}

View file

@ -177,8 +177,8 @@ void IrTypeClass::addBaseClassData(
// advance offset to right past this field
offset = vd->offset + vd->type->size();
// create ir field
vd->aggrIndex = static_cast<unsigned>(field_index);
// set the field index
getIrField(vd, true)->setAggrIndex(static_cast<unsigned>(field_index));
++field_index;
}

View file

@ -241,7 +241,8 @@ IrTypeStruct* IrTypeStruct::get(StructDeclaration* sd)
offset = vd->offset + vd->type->size();
// set the field index
vd->aggrIndex = (unsigned)field_index++;
getIrField(vd, true)->setAggrIndex(static_cast<unsigned>(field_index));
++field_index;
}
// tail padding?

View file

@ -19,16 +19,14 @@
IrField::IrField(VarDeclaration* v) : IrVar(v)
{
if (v->aggrIndex)
{
index = v->aggrIndex;
unionOffset = 0;
}
else
{
index = 0;
unionOffset = v->offset;
}
index = 0;
unionOffset = V->offset;
}
void IrField::setAggrIndex(unsigned aggrIndex)
{
index = aggrIndex;
unionOffset = 0;
}
extern LLConstant* get_default_initializer(VarDeclaration* vd, Initializer* init);

View file

@ -80,6 +80,7 @@ struct IrParameter : IrLocal
struct IrField : IrVar
{
IrField(VarDeclaration* v);
void setAggrIndex(unsigned aggrIndex);
unsigned index;
unsigned unionOffset;