Mercurial > projects > ldc
comparison ir/irclass.cpp @ 1253:752bed475b75
Fixed classinfo.interfaces for .. interfaces!
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Tue, 21 Apr 2009 20:19:53 +0200 |
parents | 871ae029ff49 |
children | 854e86eaa022 ec1d9dc1d32a |
comparison
equal
deleted
inserted
replaced
1252:7c1b55db4ff3 | 1253:752bed475b75 |
---|---|
422 // classinfo | 422 // classinfo |
423 LLConstant* ci = irinter->getClassInfoSymbol(); | 423 LLConstant* ci = irinter->getClassInfoSymbol(); |
424 ci = DtoBitCast(ci, classinfo_type); | 424 ci = DtoBitCast(ci, classinfo_type); |
425 | 425 |
426 // vtbl | 426 // vtbl |
427 ClassGlobalMap::iterator itv = interfaceVtblMap.find(it->base); | 427 LLConstant* vtb; |
428 assert(itv != interfaceVtblMap.end() && "interface vtbl not found"); | 428 // interface get a null |
429 LLConstant* vtb = itv->second; | 429 if (cd->isInterfaceDeclaration()) |
430 vtb = DtoBitCast(vtb, voidptrptr_type); | 430 { |
431 vtb = DtoConstSlice(DtoConstSize_t(itc->getVtblSize()), vtb); | 431 vtb = DtoConstSlice(DtoConstSize_t(0), getNullValue(voidptrptr_type)); |
432 } | |
433 else | |
434 { | |
435 ClassGlobalMap::iterator itv = interfaceVtblMap.find(it->base); | |
436 assert(itv != interfaceVtblMap.end() && "interface vtbl not found"); | |
437 vtb = itv->second; | |
438 vtb = DtoBitCast(vtb, voidptrptr_type); | |
439 vtb = DtoConstSlice(DtoConstSize_t(itc->getVtblSize()), vtb); | |
440 } | |
432 | 441 |
433 // offset | 442 // offset |
434 LLConstant* off = DtoConstSize_t(it->offset); | 443 LLConstant* off = DtoConstSize_t(it->offset); |
435 | 444 |
436 // create Interface struct | 445 // create Interface struct |
471 // return as a slice | 480 // return as a slice |
472 return DtoConstSlice( DtoConstSize_t(cd->vtblInterfaces->dim), ptr ); | 481 return DtoConstSlice( DtoConstSize_t(cd->vtblInterfaces->dim), ptr ); |
473 } | 482 } |
474 | 483 |
475 ////////////////////////////////////////////////////////////////////////////// | 484 ////////////////////////////////////////////////////////////////////////////// |
485 | |
486 void IrStruct::initializeInterface() | |
487 { | |
488 InterfaceDeclaration* base = aggrdecl->isInterfaceDeclaration(); | |
489 assert(base && "not interface"); | |
490 | |
491 // has interface vtbls? | |
492 if (!base->vtblInterfaces) | |
493 return; | |
494 | |
495 ArrayIter<BaseClass> it(*base->vtblInterfaces); | |
496 for (; !it.done(); it.next()) | |
497 { | |
498 // add to the interface list | |
499 interfacesWithVtbls.push_back(it.get()); | |
500 } | |
501 } | |
502 | |
503 ////////////////////////////////////////////////////////////////////////////// |