Merge pull request #1813 from rainers/cv11

DI: display typeof(null) as void*
This commit is contained in:
David Nadlinger 2016-10-08 11:37:10 +01:00 committed by GitHub
commit ba180bbde2
2 changed files with 31 additions and 29 deletions

View file

@ -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)
#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()) {

View file

@ -36,10 +36,11 @@ int basic_types()
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