Mercurial > projects > ldc
comparison gen/typinf.cpp @ 290:ebaf65fc4726 trunk
[svn r311] Fixed: structs no longer output two static typeinfos.
Updated the DtoTypeInfoOf helper a bit after figuring out how it worked.
author | lindquist |
---|---|
date | Sat, 21 Jun 2008 17:57:36 +0200 |
parents | 665b81613475 |
children | aaade6ded589 |
comparison
equal
deleted
inserted
replaced
289:17d3b3236334 | 290:ebaf65fc4726 |
---|---|
381 assert(tinfo->ty == Ttypedef); | 381 assert(tinfo->ty == Ttypedef); |
382 TypeTypedef *tc = (TypeTypedef *)tinfo; | 382 TypeTypedef *tc = (TypeTypedef *)tinfo; |
383 TypedefDeclaration *sd = tc->sym; | 383 TypedefDeclaration *sd = tc->sym; |
384 | 384 |
385 // TypeInfo base | 385 // TypeInfo base |
386 sd->basetype = sd->basetype->merge(); // DMD does this! | |
386 LLConstant* castbase = DtoTypeInfoOf(sd->basetype, true); | 387 LLConstant* castbase = DtoTypeInfoOf(sd->basetype, true); |
387 assert(castbase->getType() == stype->getElementType(2)); | 388 assert(castbase->getType() == stype->getElementType(2)); |
388 sinits.push_back(castbase); | 389 sinits.push_back(castbase); |
389 | 390 |
390 // char[] name | 391 // char[] name |
960 // uint m_flags; | 961 // uint m_flags; |
961 sinits.push_back(DtoConstUint(tc->hasPointers())); | 962 sinits.push_back(DtoConstUint(tc->hasPointers())); |
962 | 963 |
963 // create the symbol | 964 // create the symbol |
964 LLConstant* tiInit = llvm::ConstantStruct::get(stype, sinits); | 965 LLConstant* tiInit = llvm::ConstantStruct::get(stype, sinits); |
965 llvm::GlobalVariable* gvar = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,tiInit,toChars(),gIR->module); | |
966 | |
967 isaGlobalVar(this->ir.irGlobal->value)->setInitializer(tiInit); | 966 isaGlobalVar(this->ir.irGlobal->value)->setInitializer(tiInit); |
968 } | 967 } |
969 | 968 |
970 void TypeInfoStructDeclaration::toDt(dt_t **pdt) | 969 void TypeInfoStructDeclaration::toDt(dt_t **pdt) |
971 { | 970 { |