diff --git a/gen/dibuilder.cpp b/gen/dibuilder.cpp index f20148a361..21ea0ab1fa 100644 --- a/gen/dibuilder.cpp +++ b/gen/dibuilder.cpp @@ -658,15 +658,15 @@ ldc::DIType ldc::DIBuilder::CreateTypeDescription(Type *type, bool derefclass) { t = type->toBasetype(); } -#if LDC_LLVM_VER >= 309 - if (t->ty == Tnull) - return DBuilder.createNullPtrType(); if (t->ty == Tvoid) - return nullptr; +#if LDC_LLVM_VER >= 309 + return nullptr; #else - if (t->ty == Tvoid || t->ty == Tnull) return DBuilder.createUnspecifiedType(t->toChars()); #endif + if (t->ty == Tnull) // display null as void* + return DBuilder.createPointerType(CreateTypeDescription(Type::tvoid, false), + 8, 8, "typeof(null)"); if (t->ty == Tvector) return CreateVectorType(type); if (t->isintegral() || t->isfloating()) { diff --git a/tests/debuginfo/basictypes_cdb.d b/tests/debuginfo/basictypes_cdb.d index 6a096bfe4c..b26f33d0ac 100644 --- a/tests/debuginfo/basictypes_cdb.d +++ b/tests/debuginfo/basictypes_cdb.d @@ -9,37 +9,38 @@ // modulename explicitly unspecified to check implicit function name when breaking void main() { - basic_types(); + basic_types(); } int basic_types() { - char c = 'a'; - wchar wc = 'b'; - dchar dc = 'c'; - byte b = 1; - ubyte ub = 2; - short s = 3; - ushort us = 4; - int i = 5; - uint ui = 6; - long l = 7; - ulong ul = 8; + char c = 'a'; + wchar wc = 'b'; + dchar dc = 'c'; + byte b = 1; + ubyte ub = 2; + short s = 3; + ushort us = 4; + int i = 5; + uint ui = 6; + long l = 7; + ulong ul = 8; - float f = 9; - double d = 10; - real r = 11; - - ifloat iflt = 12i; - idouble id = 13i; - ireal ir = 14i; - cfloat cf = 15 + 16i; - cdouble cd = 17 + 18i; - creal cr = 19 + 20i; + float f = 9; + double d = 10; + real r = 11; + ifloat iflt = 12i; + idouble id = 13i; + ireal ir = 14i; + cfloat cf = 15 + 16i; + cdouble cd = 17 + 18i; + creal cr = 19 + 20i; + typeof(null) np = null; + c = c; // CDB: ld basictypes_cdb* -// CDB: bp `basictypes_cdb.d:39` +// CDB: bp `basictypes_cdb.d:41` // CDB: g // CHECK: !basictypes_cdb.basic_types @@ -66,6 +67,7 @@ int basic_types() // CHECK: struct cfloat cf // CHECK: struct cdouble cd // CHECK: struct creal cr +// CHECK: void * np = 0x{{[0`]+}} // CDB: ?? cf // CHECK: +0x000 re : 15 // CHECK: +0x004 im : 16 @@ -75,7 +77,7 @@ int basic_types() // CDB: ?? cr // CHECK: +0x000 re : 19 // CHECK: +0x008 im : 20 - return 1; + return 1; } // CDB: q // CHECK: quit