From a78ccbf851c5f89b6aeabe53754028ef5fa74202 Mon Sep 17 00:00:00 2001 From: kai Date: Tue, 2 Jul 2013 22:48:04 +0200 Subject: [PATCH] Fix assertion error with LLVM 3.4. There is a distinction between compile unit and file which is disregarded by ldc. It is possible that more places are broken. --- gen/todebug.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gen/todebug.cpp b/gen/todebug.cpp index d2f12359..b7ef4735 100644 --- a/gen/todebug.cpp +++ b/gen/todebug.cpp @@ -315,6 +315,8 @@ static llvm::DIType dwarfCompositeType(Type* type) // defaults llvm::StringRef name = sd->toChars(); unsigned linnum = sd->loc.linnum; + llvm::DICompileUnit CU(gIR->dibuilder.getCU()); + assert(CU && CU.Verify() && "Compilation unit missing or corrupted"); llvm::DIFile file = DtoDwarfFile(sd->loc); llvm::DIType derivedFrom; @@ -355,9 +357,9 @@ static llvm::DIType dwarfCompositeType(Type* type) llvm::DIType ret; if (t->ty == Tclass) { ret = gIR->dibuilder.createClassType( - llvm::DIDescriptor(file), + CU, // compile unit where defined name, // name - file, // compile unit where defined + file, // file where defined linnum, // line number where defined getTypeBitSize(T), // size in bits getABITypeAlign(T)*8, // alignment in bits @@ -368,9 +370,9 @@ static llvm::DIType dwarfCompositeType(Type* type) ); } else { ret = gIR->dibuilder.createStructType( - llvm::DIDescriptor(file), + CU, // compile unit where defined name, // name - file, // compile unit where defined + file, // file where defined linnum, // line number where defined getTypeBitSize(T), // size in bits getABITypeAlign(T)*8, // alignment in bits