Remove d-support.c and use gdb_demangle for demangling D symbols.
[deliverable/binutils-gdb.git] / gdb / d-lang.c
index 87d82da2e80a42717bec74b900a9e5526ff4287a..e98138fe188b9c679e4764bacc400508c5d35a25 100644 (file)
@@ -23,8 +23,8 @@
 #include "varobj.h"
 #include "d-lang.h"
 #include "c-lang.h"
-#include "parser-defs.h"
-#include "gdb_obstack.h"
+#include "demangle.h"
+#include "cp-support.h"
 
 /* The name of the symbol to use to get the name of the main subprogram.  */
 static const char D_MAIN[] = "D main";
@@ -52,37 +52,7 @@ d_main_name (void)
 char *
 d_demangle (const char *symbol, int options)
 {
-  struct obstack tempbuf;
-  char *result;
-
-  if ((symbol == NULL) || (*symbol == '\0'))
-    return NULL;
-  else if (strcmp (symbol, "_Dmain") == 0)
-    return xstrdup ("D main");
-
-  obstack_init (&tempbuf);
-
-  if (strncmp (symbol, "_D", 2) == 0)
-    symbol += 2;
-  else
-    {
-      obstack_free (&tempbuf, NULL);
-      return NULL;
-    }
-
-  if (d_parse_symbol (&tempbuf, symbol) != NULL)
-    {
-      obstack_grow_str0 (&tempbuf, "");
-      result = xstrdup (obstack_finish (&tempbuf));
-      obstack_free (&tempbuf, NULL);
-    }
-  else
-    {
-      obstack_free (&tempbuf, NULL);
-      return NULL;
-    }
-
-  return result;
+  return gdb_demangle (symbol, options | DMGL_DLANG);
 }
 
 /* Table mapping opcodes into strings for printing operators
This page took 0.040065 seconds and 4 git commands to generate.