comparison ir/irclass.cpp @ 1235:ded6a557220a

Too strict assertion with generating the interfaceInfosZ symbol. Baseclasses might introduce interfaces.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Thu, 16 Apr 2009 21:00:49 +0200
parents 212ec2d9d176
children 57db55766118
comparison
equal deleted inserted replaced
1234:9201e0d41ee5 1235:ded6a557220a
79 if (classInterfacesArray) 79 if (classInterfacesArray)
80 return classInterfacesArray; 80 return classInterfacesArray;
81 81
82 ClassDeclaration* cd = aggrdecl->isClassDeclaration(); 82 ClassDeclaration* cd = aggrdecl->isClassDeclaration();
83 83
84 // FIXME: 84 size_t n = type->irtype->isClass()->getNumInterfaceVtbls();
85 // also happens for mini/s.d :( 85 assert(n > 0 && "getting ClassInfo.interfaces storage symbol, but we "
86 assert(cd->vtblInterfaces && cd->vtblInterfaces->dim > 0 && 86 "don't implement any interfaces");
87 "should not create interface info array for class with no explicit "
88 "interface implementations");
89 87
90 VarDeclarationIter idx(ClassDeclaration::classinfo->fields, 3); 88 VarDeclarationIter idx(ClassDeclaration::classinfo->fields, 3);
91 const llvm::Type* InterfaceTy = DtoType(idx->type->next); 89 const llvm::Type* InterfaceTy = DtoType(idx->type->next);
92 90
93 // create Interface[N] 91 // create Interface[N]
94 const llvm::ArrayType* array_type = llvm::ArrayType::get( 92 const llvm::ArrayType* array_type = llvm::ArrayType::get(InterfaceTy,n);
95 InterfaceTy,
96 type->irtype->isClass()->getNumInterfaceVtbls());
97 93
98 // put it in a global 94 // put it in a global
99 std::string name("_D"); 95 std::string name("_D");
100 name.append(cd->mangle()); 96 name.append(cd->mangle());
101 name.append("16__interfaceInfosZ"); 97 name.append("16__interfaceInfosZ");