From e0331c7b53e55012c901a932f6b837d5ef99ce4f Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 26 Jun 2009 21:00:12 +0200 Subject: [PATCH] Make debug info work with newer LLVM. --- gen/todebug.cpp | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/gen/todebug.cpp b/gen/todebug.cpp index da4c5ef8..7eff09d8 100644 --- a/gen/todebug.cpp +++ b/gen/todebug.cpp @@ -45,23 +45,6 @@ static LLGlobalVariable* emitDwarfGlobalDecl(const LLStructType* type, const cha ////////////////////////////////////////////////////////////////////////////////////////////////// -static llvm::DIAnchor getDwarfAnchor(dwarf_constants c) -{ - switch (c) - { - case DW_TAG_compile_unit: - return gIR->difactory.GetOrCreateCompileUnitAnchor(); - case DW_TAG_variable: - return gIR->difactory.GetOrCreateGlobalVariableAnchor(); - case DW_TAG_subprogram: - return gIR->difactory.GetOrCreateSubprogramAnchor(); - default: - assert(0); - } -} - -////////////////////////////////////////////////////////////////////////////////////////////////// - static const llvm::StructType* getDwarfCompileUnitType() { return isaStruct(gIR->module->getTypeByName("llvm.dbg.compile_unit.type")); } @@ -311,7 +294,11 @@ static llvm::DICompositeType dwarfCompositeType(Type* type, llvm::DICompileUnit // set to handle recursive types properly gv = emitDwarfGlobalDecl(getDwarfCompositeTypeType(), "llvm.dbg.compositetype"); // set bogus initializer to satisfy asserts in DICompositeType constructor - gv->setInitializer(LLConstant::getNullValue(getDwarfCompositeTypeType())); + std::vector initvals(11); + initvals[0] = DBG_TAG(DW_TAG_structure_type); + for (int i = 1; i < initvals.size(); ++i) + initvals[i] = LLConstant::getNullValue(getDwarfCompositeTypeType()->getContainedType(i)); + gv->setInitializer(LLConstantStruct::get(getDwarfCompositeTypeType(), initvals)); ir->diCompositeType = llvm::DICompositeType(gv); tag = DW_TAG_structure_type;