comparison gen/llvmhelpers.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 17d3b3236334
children 068cb3c60afb
comparison
equal deleted inserted replaced
289:17d3b3236334 290:ebaf65fc4726
1083 1083
1084 ////////////////////////////////////////////////////////////////////////////////////////// 1084 //////////////////////////////////////////////////////////////////////////////////////////
1085 1085
1086 LLConstant* DtoTypeInfoOf(Type* type, bool base) 1086 LLConstant* DtoTypeInfoOf(Type* type, bool base)
1087 { 1087 {
1088 type = type->merge(); // seems like this is needed in some cases with templates. 1088 type = type->merge(); // needed.. getTypeInfo does the same
1089 const LLType* typeinfotype = DtoType(Type::typeinfo->type); 1089 type->getTypeInfo(NULL);
1090 if (!type->vtinfo)
1091 type->getTypeInfo(NULL);
1092 TypeInfoDeclaration* tidecl = type->vtinfo; 1090 TypeInfoDeclaration* tidecl = type->vtinfo;
1091 assert(tidecl);
1093 DtoForceDeclareDsymbol(tidecl); 1092 DtoForceDeclareDsymbol(tidecl);
1094 assert(tidecl->ir.irGlobal != NULL); 1093 assert(tidecl->ir.irGlobal != NULL);
1095 LLConstant* c = isaConstant(tidecl->ir.irGlobal->value); 1094 LLConstant* c = isaConstant(tidecl->ir.irGlobal->value);
1096 assert(c != NULL); 1095 assert(c != NULL);
1097 if (base) 1096 if (base)
1098 return llvm::ConstantExpr::getBitCast(c, typeinfotype); 1097 return llvm::ConstantExpr::getBitCast(c, DtoType(Type::typeinfo->type));
1099 return c; 1098 return c;
1100 } 1099 }
1101 1100
1102 ////////////////////////////////////////////////////////////////////////////////////////// 1101 //////////////////////////////////////////////////////////////////////////////////////////
1103 1102