-/* Demangler for IA64 / g++ standard C++ ABI.
+/* Demangler for IA64 / g++ V3 ABI.
Copyright (C) 2000 Free Software Foundation, Inc.
Written by Alex Samuel <samuel@codesourcery.com>.
*/
/* This file implements demangling of C++ names mangled according to
- the IA64 / g++ standard C++ ABI. Use the cp_demangle function to
+ the IA64 / g++ V3 ABI. Use the cp_demangle function to
demangle a mangled name, or compile with the preprocessor macro
STANDALONE_DEMANGLER defined to create a demangling filter
executable (functionally similar to c++filt, but includes this
extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *));
-/* ABI-mandated entry point in the C++ runtime library for performing
+/* ia64 ABI-mandated entry point in the C++ runtime library for performing
demangling. MANGLED_NAME is a NUL-terminated character string
containing the name to be demangled.
If the demangling failes, returns NULL. */
char *
-cplus_demangle_new_abi (mangled)
+cplus_demangle_v3 (mangled)
const char* mangled;
{
+ dyn_string_t demangled;
+ status_t status;
+
+ /* If this isn't a mangled name, don't pretend to demangle it. */
+ if (strncmp (mangled, "_Z", 2) != 0)
+ return NULL;
+
/* Create a dyn_string to hold the demangled name. */
- dyn_string_t demangled = dyn_string_new (0);
+ demangled = dyn_string_new (0);
/* Attempt the demangling. */
- status_t status = cp_demangle ((char *) mangled, demangled);
+ status = cp_demangle ((char *) mangled, demangled);
+
if (STATUS_NO_ERROR (status))
/* Demangling succeeded. */
{