diff 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
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp	Sat Jun 21 16:22:29 2008 +0200
+++ b/gen/llvmhelpers.cpp	Sat Jun 21 17:57:36 2008 +0200
@@ -1085,17 +1085,16 @@
 
 LLConstant* DtoTypeInfoOf(Type* type, bool base)
 {
-    type = type->merge(); // seems like this is needed in some cases with templates.
-    const LLType* typeinfotype = DtoType(Type::typeinfo->type);
-    if (!type->vtinfo)
-        type->getTypeInfo(NULL);
+    type = type->merge(); // needed.. getTypeInfo does the same
+    type->getTypeInfo(NULL);
     TypeInfoDeclaration* tidecl = type->vtinfo;
+    assert(tidecl);
     DtoForceDeclareDsymbol(tidecl);
     assert(tidecl->ir.irGlobal != NULL);
     LLConstant* c = isaConstant(tidecl->ir.irGlobal->value);
     assert(c != NULL);
     if (base)
-        return llvm::ConstantExpr::getBitCast(c, typeinfotype);
+        return llvm::ConstantExpr::getBitCast(c, DtoType(Type::typeinfo->type));
     return c;
 }