Mercurial > projects > ldc
comparison gen/llvmhelpers.cpp @ 289:17d3b3236334 trunk
[svn r310] Fixed a problem with incomplete types and templates in typeinfo code.
author | lindquist |
---|---|
date | Sat, 21 Jun 2008 16:22:29 +0200 |
parents | 70c370e97944 |
children | ebaf65fc4726 |
comparison
equal
deleted
inserted
replaced
288:ba4e4298009a | 289:17d3b3236334 |
---|---|
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 const LLType* typeinfotype = DtoType(Type::typeinfo->type); | 1089 const LLType* typeinfotype = DtoType(Type::typeinfo->type); |
1089 if (!type->vtinfo) | 1090 if (!type->vtinfo) |
1090 type->getTypeInfo(NULL); | 1091 type->getTypeInfo(NULL); |
1091 TypeInfoDeclaration* tidecl = type->vtinfo; | 1092 TypeInfoDeclaration* tidecl = type->vtinfo; |
1092 DtoForceDeclareDsymbol(tidecl); | 1093 DtoForceDeclareDsymbol(tidecl); |
1096 if (base) | 1097 if (base) |
1097 return llvm::ConstantExpr::getBitCast(c, typeinfotype); | 1098 return llvm::ConstantExpr::getBitCast(c, typeinfotype); |
1098 return c; | 1099 return c; |
1099 } | 1100 } |
1100 | 1101 |
1102 ////////////////////////////////////////////////////////////////////////////////////////// | |
1103 | |
1101 void findDefaultTarget() | 1104 void findDefaultTarget() |
1102 { | 1105 { |
1103 std::string err_str; | 1106 std::string err_str; |
1104 const llvm::TargetMachineRegistry::entry* e = llvm::TargetMachineRegistry::getClosestTargetForJIT(err_str); | 1107 const llvm::TargetMachineRegistry::entry* e = llvm::TargetMachineRegistry::getClosestTargetForJIT(err_str); |
1105 if (e == 0) | 1108 if (e == 0) |