[pkg-d-commits] [ldc] 69/211: DI: display typeof(null) as void*

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:36:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.1.0
in repository ldc.

commit 9d1637f410c84cf4fc246f9d450f77ccfe261024
Author: Rainer Schuetze <r.sagitario at gmx.de>
Date:   Sat Oct 8 10:03:07 2016 +0200

    DI: display typeof(null) as void*
---
 gen/dibuilder.cpp                | 10 ++++----
 tests/debuginfo/basictypes_cdb.d | 50 +++++++++++++++++++++-------------------
 2 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/gen/dibuilder.cpp b/gen/dibuilder.cpp
index f7c7232..9f52bde 100644
--- a/gen/dibuilder.cpp
+++ b/gen/dibuilder.cpp
@@ -656,15 +656,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 6a096bf..b26f33d 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list