changeset 1517:a7a9e461512a

Make debug info work with newer LLVM.
author Christian Kamm <kamm incasoftware de>
date Fri, 26 Jun 2009 21:00:12 +0200
parents 0f08b145b878
children 26d061e61b02
files gen/todebug.cpp
diffstat 1 files changed, 5 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- 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<LLConstant*> 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;