More Dwarf debug code changes.

Add a fix for LLVM 3.3 (`createTemporaryType()` was removed) and add
linkage name to `createGlobalVariable()` (new in 3.3).
This commit is contained in:
kai
2013-03-23 15:40:29 +01:00
parent 7d65a311b1
commit c8d98ad31c

View File

@@ -254,8 +254,19 @@ static llvm::DIType dwarfCompositeType(Type* type)
llvm::DIType derivedFrom;
// set diCompositeType to handle recursive types properly
if (!ir->diCompositeType)
if (!ir->diCompositeType) {
#if LDC_LLVM_VER >= 301
unsigned tag = (t->ty == Tstruct) ? llvm::dwarf::DW_TAG_structure_type
: llvm::dwarf::DW_TAG_class_type;
ir->diCompositeType = gIR->dibuilder.createForwardDecl(tag, name,
#if LDC_LLVM_VER >= 302
llvm::DIDescriptor(file),
#endif
file, linnum);
#else
ir->diCompositeType = gIR->dibuilder.createTemporaryType();
#endif
}
if (!ir->aggrdecl->isInterfaceDeclaration()) // plain interfaces don't have one
{
@@ -325,7 +336,10 @@ static llvm::DIGlobalVariable dwarfGlobalVariable(LLGlobalVariable* ll, VarDecla
assert(vd->isDataseg() || (vd->storage_class & (STCconst | STCimmutable) && vd->init));
return gIR->dibuilder.createGlobalVariable(
vd->toChars(), // name TODO: mangle() or toPrettyChars() instead?
vd->toChars(), // name
#if LDC_LLVM_VER >= 303
vd->mangle(), // linkage name
#endif
DtoDwarfFile(vd->loc), // file
vd->loc.linnum, // line num
dwarfTypeDescription_impl(vd->type, NULL), // type