# HG changeset patch # User Christian Kamm # Date 1246042812 -7200 # Node ID a7a9e461512a8648f6fe82a6ac7912f140269717 # Parent 0f08b145b8787a387a1b958f804300134b0bcbf4 Make debug info work with newer LLVM. diff -r 0f08b145b878 -r a7a9e461512a gen/todebug.cpp --- a/gen/todebug.cpp Fri Jun 26 17:18:36 2009 +0200 +++ b/gen/todebug.cpp Fri Jun 26 21:00:12 2009 +0200 @@ -45,23 +45,6 @@ ////////////////////////////////////////////////////////////////////////////////////////////////// -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 @@ // 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;