void DtoResolveStruct(StructDeclaration* sd, Loc& callerLoc) { // Make sure to resolve each struct type exactly once. if (sd->ir.isResolved()) return; sd->ir.setResolved(); IF_LOG Logger::println("Resolving struct type: %s (%s)", sd->toChars(), sd->loc.toChars()); LOG_SCOPE; // make sure type exists DtoType(sd->type); // if it's a forward declaration, all bets are off. The type should be enough if (sd->sizeok != SIZEOKdone) { error(callerLoc, "struct %s.%s unknown size", sd->getModule()->toChars(), sd->toChars()); fatal(); } // create the IrAggr getIrAggr(sd, true); // Set up our field metadata. for (VarDeclarations::iterator I = sd->fields.begin(), E = sd->fields.end(); I != E; ++I) { VarDeclaration *vd = *I; IF_LOG { if (isIrFieldCreated(vd)) Logger::println("struct field already exists"); } getIrField(vd, true); } }
void DtoResolveClass(ClassDeclaration* cd) { if (cd->ir.isResolved()) return; cd->ir.setResolved(); IF_LOG Logger::println("DtoResolveClass(%s): %s", cd->toPrettyChars(), cd->loc.toChars()); LOG_SCOPE; // make sure the base classes are processed first for (BaseClasses::iterator I = cd->baseclasses->begin(), E = cd->baseclasses->end(); I != E; ++I) { DtoResolveClass((*I)->base); } // make sure type exists DtoType(cd->type); // create IrAggr IrAggr* irAggr = getIrAggr(cd, true); // make sure all fields really get their ir field for (VarDeclarations::iterator I = cd->fields.begin(), E = cd->fields.end(); I != E; ++I) { VarDeclaration* vd = *I; IF_LOG { if (isIrFieldCreated(vd)) Logger::println("class field already exists"); } getIrField(vd, true); } // emit the interfaceInfosZ symbol if necessary if (cd->vtblInterfaces && cd->vtblInterfaces->dim > 0) irAggr->getInterfaceArraySymbol(); // initializer is applied when it's built // interface only emit typeinfo and classinfo if (cd->isInterfaceDeclaration()) { irAggr->initializeInterface(); } }
void DtoResolveClass(ClassDeclaration *cd) { if (cd->ir->isResolved()) { return; } cd->ir->setResolved(); IF_LOG Logger::println("DtoResolveClass(%s): %s", cd->toPrettyChars(), cd->loc.toChars()); LOG_SCOPE; // make sure the base classes are processed first for (auto bc : *cd->baseclasses) { DtoResolveClass(bc->sym); } // make sure type exists DtoType(cd->type); // create IrAggr IrAggr *irAggr = getIrAggr(cd, true); // make sure all fields really get their ir field for (auto vd : cd->fields) { IF_LOG { if (isIrFieldCreated(vd)) { Logger::println("class field already exists"); } } getIrField(vd, true); } // emit the interfaceInfosZ symbol if necessary if (cd->vtblInterfaces && cd->vtblInterfaces->dim > 0) { irAggr->getInterfaceArraySymbol(); // initializer is applied when it's built } // interface only emit typeinfo and classinfo if (cd->isInterfaceDeclaration()) { irAggr->initializeInterface(); } }