# HG changeset patch # User Tomas Lindquist Olsen # Date 1239909051 -7200 # Node ID 57db557661181ff26da43a54b83ff13cfd2ac1bd # Parent ded6a557220a3b182a92797465a5bfdaf02f91ea Fixed ClassInfo.interfaces. mini/s.d now runs again. diff -r ded6a557220a -r 57db55766118 ir/irclass.cpp --- a/ir/irclass.cpp Thu Apr 16 21:00:49 2009 +0200 +++ b/ir/irclass.cpp Thu Apr 16 21:10:51 2009 +0200 @@ -384,11 +384,10 @@ assert(type->irtype->isClass()->getNumInterfaceVtbls() == n && "inconsistent number of interface vtables in this class"); + VarDeclarationIter interfaces_idx(ClassDeclaration::classinfo->fields, 3); + if (n == 0) - { - VarDeclarationIter idx(ClassDeclaration::classinfo->fields, 3); - return getNullValue(DtoType(idx->type)); - } + return getNullValue(DtoType(interfaces_idx->type)); // Build array of: // @@ -447,22 +446,29 @@ LLConstant* arr = llvm::ConstantArray::get( array_type, &constants[0], - constants.size()); + n); // apply the initializer classInterfacesArray->setInitializer(arr); + // return null, only baseclass provide interfaces + if (cd->vtblInterfaces->dim == 0) + { + return getNullValue(DtoType(interfaces_idx->type)); + } + + // only the interface explicitly implemented by this class + // (not super classes) should show in ClassInfo LLConstant* idxs[2] = { DtoConstSize_t(0), - // only the interface explicitly implemented by this class - // (not super classes) should show in ClassInfo DtoConstSize_t(n - cd->vtblInterfaces->dim) }; + LLConstant* ptr = llvm::ConstantExpr::getGetElementPtr( + classInterfacesArray, idxs, 2); + // return as a slice - return DtoConstSlice( - DtoConstSize_t(n), - llvm::ConstantExpr::getGetElementPtr(classInterfacesArray, idxs, 2)); + return DtoConstSlice( DtoConstSize_t(cd->vtblInterfaces->dim), ptr ); } //////////////////////////////////////////////////////////////////////////////