Mercurial > projects > ldc
comparison gen/todebug.cpp @ 1650:40bd4a0d4870
Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).
Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.
Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
author | Tomas Lindquist Olsen |
---|---|
date | Wed, 19 May 2010 12:42:32 +0200 |
parents | 8d086d552909 |
children |
comparison
equal
deleted
inserted
replaced
1649:36da40ecbbe0 | 1650:40bd4a0d4870 |
---|---|
16 #include "gen/utils.h" | 16 #include "gen/utils.h" |
17 | 17 |
18 #include "ir/irmodule.h" | 18 #include "ir/irmodule.h" |
19 | 19 |
20 using namespace llvm::dwarf; | 20 using namespace llvm::dwarf; |
21 | |
22 #ifndef DISABLE_DEBUG_INFO | |
21 | 23 |
22 #define DBG_NULL ( LLConstant::getNullValue(DBG_TYPE) ) | 24 #define DBG_NULL ( LLConstant::getNullValue(DBG_TYPE) ) |
23 #define DBG_TYPE ( getPtrToType(llvm::StructType::get(gIR->context(),NULL,NULL)) ) | 25 #define DBG_TYPE ( getPtrToType(llvm::StructType::get(gIR->context(),NULL,NULL)) ) |
24 #define DBG_CAST(X) ( llvm::ConstantExpr::getBitCast(X, DBG_TYPE) ) | 26 #define DBG_CAST(X) ( llvm::ConstantExpr::getBitCast(X, DBG_TYPE) ) |
25 | 27 |
218 LLGlobalVariable* ptr = dwarfMemberType(vd->loc.linnum, vd->type, compileUnit, definedCU, vd->toChars(), vd->offset).getGV(); | 220 LLGlobalVariable* ptr = dwarfMemberType(vd->loc.linnum, vd->type, compileUnit, definedCU, vd->toChars(), vd->offset).getGV(); |
219 elems.push_back(DBG_CAST(ptr)); | 221 elems.push_back(DBG_CAST(ptr)); |
220 } | 222 } |
221 } | 223 } |
222 | 224 |
223 //FIXME: This does not use llvm's DIFactory as it can't | 225 //FIXME: This does not use llvm's DIFactory as it can't |
224 // handle recursive types properly. | 226 // handle recursive types properly. |
225 static llvm::DICompositeType dwarfCompositeType(Type* type, llvm::DICompileUnit compileUnit) | 227 static llvm::DICompositeType dwarfCompositeType(Type* type, llvm::DICompileUnit compileUnit) |
226 { | 228 { |
227 const LLType* T = DtoType(type); | 229 const LLType* T = DtoType(type); |
228 Type* t = type->toBasetype(); | 230 Type* t = type->toBasetype(); |
528 "LDC (http://www.dsource.org/projects/ldc)", | 530 "LDC (http://www.dsource.org/projects/ldc)", |
529 //FIXME: What do these two mean? | 531 //FIXME: What do these two mean? |
530 false, // isMain, | 532 false, // isMain, |
531 false // isOptimized | 533 false // isOptimized |
532 ); | 534 ); |
533 | 535 |
534 // if the linkage stays internal, we can't llvm-link the generated modules together: | 536 // if the linkage stays internal, we can't llvm-link the generated modules together: |
535 // llvm's DwarfWriter uses path and filename to determine the symbol name and we'd | 537 // llvm's DwarfWriter uses path and filename to determine the symbol name and we'd |
536 // end up with duplicate symbols | 538 // end up with duplicate symbols |
537 irmod->diCompileUnit.getGV()->setLinkage(DEBUGINFO_LINKONCE_LINKAGE_TYPE); | 539 irmod->diCompileUnit.getGV()->setLinkage(DEBUGINFO_LINKONCE_LINKAGE_TYPE); |
538 irmod->diCompileUnit.getGV()->setName(std::string("llvm.dbg.compile_unit_") + srcpath + m->srcfile->name->toChars()); | 540 irmod->diCompileUnit.getGV()->setName(std::string("llvm.dbg.compile_unit_") + srcpath + m->srcfile->name->toChars()); |
634 ln, // line no | 636 ln, // line no |
635 0, // col no | 637 0, // col no |
636 gIR->scopebb() | 638 gIR->scopebb() |
637 ); | 639 ); |
638 } | 640 } |
641 | |
642 #endif |