From 4971321caf61bc52513f4d64028e8f6dd2f714a6 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Fri, 7 Jun 2013 21:20:14 +0200 Subject: [PATCH] Revert "Add debug info for enums." This reverts commit 001a39642fe94b5ab482e12b7f645c74d350afd1, as it leads to debug mode crashes in rt.lifetime and other modules. Specifically, the type check assertion in IntegerExp::toInteger (at expression.c:2017) is hit. --- gen/todebug.cpp | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/gen/todebug.cpp b/gen/todebug.cpp index dd1c20ff..325e4dc5 100644 --- a/gen/todebug.cpp +++ b/gen/todebug.cpp @@ -146,35 +146,11 @@ static llvm::DIType dwarfBasicType(Type* type) static llvm::DIType dwarfEnumType(Type *type) { llvm::Type *T = DtoType(type); + Type *t = type->toBasetype(); - assert(type->ty = Tenum && "only enums allowed for debug info in dwarfEnumType"); - TypeEnum *te = static_cast(type); - llvm::SmallVector subscripts; - for (ArrayIter it(te->sym->members); it.more(); it.next()) - { - EnumMember *em = it->isEnumMember(); - llvm::StringRef Name(em->toChars() /*em->ident->string*/); - uint64_t Val = em->value->toInteger(); - llvm::Value *Subscript = gIR->dibuilder.createEnumerator(Name, Val); - subscripts.push_back(Subscript); - } + // FIXME - llvm::StringRef Name = te->toChars(); - unsigned LineNumber = te->sym->loc.linnum; - llvm::DIFile File = DtoDwarfFile(te->sym->loc); - - return gIR->dibuilder.createEnumerationType( - llvm::DIDescriptor(File), - Name, - File, - LineNumber, - getTypeBitSize(T), // size (bits) - getABITypeAlign(T)*8, // align (bits) - gIR->dibuilder.getOrCreateArray(subscripts) // subscripts -#if LDC_LLVM_VER >= 302 - , dwarfTypeDescription_impl(te->sym->memtype, NULL) -#endif - ); + return llvm::DIType(NULL); } ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -484,14 +460,12 @@ static llvm::DIType dwarfTypeDescription_impl(Type* type, const char* c_name) Type* t = type->toBasetype(); if (t->ty == Tvoid) return llvm::DIType(NULL); + else if (t->ty == Tvector) + return dwarfVectorType(type); + else if (t->ty == Tenum) + return dwarfEnumType(type); else if (t->isintegral() || t->isfloating()) - { - if (t->ty == Tvector) - return dwarfVectorType(type); - if (type->ty == Tenum) - return dwarfEnumType(type); return dwarfBasicType(type); - } else if (t->ty == Tpointer) return dwarfPointerType(type); else if (t->ty == Tarray)