Replace ArrayIter<> with Array<>::iterator.

Just use the new iterator instead of the old Java-like class.
Also removes a dead iterator and replaces an iterator with a
pointer in some place.
This commit is contained in:
kai
2014-01-11 14:48:41 +01:00
parent 5aa06092cd
commit 6287a4d422
7 changed files with 56 additions and 53 deletions

View File

@@ -25,7 +25,6 @@
#include "gen/logger.h"
#include "gen/tollvm.h"
#include "gen/llvmhelpers.h"
#include "gen/utils.h"
#include "gen/arrays.h"
#include "gen/metadata.h"
#include "gen/runtime.h"
@@ -126,8 +125,7 @@ LLGlobalVariable * IrAggr::getInterfaceArraySymbol()
assert(n > 0 && "getting ClassInfo.interfaces storage symbol, but we "
"don't implement any interfaces");
VarDeclarationIter idx(Type::typeinfoclass->fields, 3);
LLType* InterfaceTy = DtoType(idx->type->nextOf());
LLType* InterfaceTy = DtoType(Type::typeinfoclass->fields[3]->type->nextOf());
// create Interface[N]
LLArrayType* array_type = llvm::ArrayType::get(InterfaceTy,n);
@@ -283,9 +281,6 @@ llvm::GlobalVariable * IrAggr::getInterfaceVtbl(BaseClass * b, bool new_instance
constants.reserve(vtbl_array.dim);
if (!b->base->isCPPinterface()) { // skip interface info for CPP interfaces
// start with the interface info
VarDeclarationIter interfaces_idx(Type::typeinfoclass->fields, 3);
// index into the interfaces array
llvm::Constant* idxs[2] = {
DtoConstSize_t(0),
@@ -415,7 +410,7 @@ LLConstant * IrAggr::getClassInfoInterfaces()
assert(stripModifiers(type)->irtype->isClass()->getNumInterfaceVtbls() == n &&
"inconsistent number of interface vtables in this class");
VarDeclarationIter interfaces_idx(Type::typeinfoclass->fields, 3);
VarDeclaration *interfaces_idx = Type::typeinfoclass->fields[3];
if (n == 0)
return getNullValue(DtoType(interfaces_idx->type));
@@ -435,7 +430,7 @@ LLConstant * IrAggr::getClassInfoInterfaces()
LLType* classinfo_type = DtoType(Type::typeinfoclass->type);
LLType* voidptrptr_type = DtoType(
Type::tvoid->pointerTo()->pointerTo());
VarDeclarationIter idx(Type::typeinfoclass->fields, 3);
VarDeclaration *idx = Type::typeinfoclass->fields[3];
LLStructType* interface_type = isaStruct(DtoType(idx->type->nextOf()));
assert(interface_type);
@@ -517,11 +512,12 @@ void IrAggr::initializeInterface()
if (!base->vtblInterfaces)
return;
ArrayIter<BaseClass> it(*base->vtblInterfaces);
for (; !it.done(); it.next())
for (BaseClasses::iterator I = base->vtblInterfaces->begin(),
E = base->vtblInterfaces->end();
I != E; ++I)
{
// add to the interface list
interfacesWithVtbls.push_back(it.get());
interfacesWithVtbls.push_back(*I);
}
}