aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-24 14:05:15 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-24 14:05:15 +0000
commit10787737cbb13dc7c0e369b5b083ce413ebbea54 (patch)
tree5d07b80178b4041baed0258be71c03f7efbccc0b /libiberty
parentea1490f98d69909d5055a5cfdd897900f57b1356 (diff)
Mainline merge as of 2002-07-21.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@55706 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog10
-rw-r--r--libiberty/cp-demangle.c42
-rw-r--r--libiberty/testsuite/demangle-expected4
3 files changed, 54 insertions, 2 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index cba9742f6b2..5d9552fb3e7 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,13 @@
+2002-07-10 Jason Merrill <jason@redhat.com>
+
+ * cp-demangle.c (demangle_identifier): Support extended Unicode
+ characters.
+
+2002-07-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-demangle.c (demangle_v3_with_details): Wrap in
+ !defined IN_GLIBCPP_V3.
+
2002-07-01 Mark Mitchell <mark@codesourcery.com>
* cp-demangle.c (demangle_operator_name): Add type_arg parameter.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 162aafca78e..eece533e070 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -51,6 +51,8 @@
#include <string.h>
#endif
+#include <ctype.h>
+
#include "ansidecl.h"
#include "libiberty.h"
#include "dyn-string.h"
@@ -1466,9 +1468,45 @@ demangle_identifier (dm, length, identifier)
while (length-- > 0)
{
+ int ch;
if (end_of_name_p (dm))
return "Unexpected end of name in <identifier>.";
- if (!dyn_string_append_char (identifier, next_char (dm)))
+ ch = next_char (dm);
+
+ /* Handle extended Unicode characters. We encode them as __U{hex}_,
+ where {hex} omits leading 0's. For instance, '$' is encoded as
+ "__U24_". */
+ if (ch == '_'
+ && peek_char (dm) == '_'
+ && peek_char_next (dm) == 'U')
+ {
+ char buf[10];
+ int pos = 0;
+ advance_char (dm); advance_char (dm); length -= 2;
+ while (length-- > 0)
+ {
+ ch = next_char (dm);
+ if (!isxdigit (ch))
+ break;
+ buf[pos++] = ch;
+ }
+ if (ch != '_' || length < 0)
+ return STATUS_ERROR;
+ if (pos == 0)
+ {
+ /* __U_ just means __U. */
+ if (!dyn_string_append_cstr (identifier, "__U"))
+ return STATUS_ALLOCATION_FAILED;
+ continue;
+ }
+ else
+ {
+ buf[pos] = '\0';
+ ch = strtol (buf, 0, 16);
+ }
+ }
+
+ if (!dyn_string_append_char (identifier, ch))
return STATUS_ALLOCATION_FAILED;
}
@@ -3880,6 +3918,7 @@ java_demangle_v3 (mangled)
#endif /* IN_LIBGCC2 || IN_GLIBCPP_V3 */
+#ifndef IN_GLIBCPP_V3
/* Demangle NAME in the G++ V3 ABI demangling style, and return either
zero, indicating that some error occurred, or a demangling_t
holding the results. */
@@ -3917,7 +3956,6 @@ demangle_v3_with_details (name)
}
-#ifndef IN_GLIBCPP_V3
/* Return non-zero iff NAME is the mangled form of a constructor name
in the G++ V3 ABI demangling style. Specifically, return:
- '1' if NAME is a complete object constructor,
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 81b061d5b28..ecdd732c370 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -2587,6 +2587,10 @@ JArray.t(JArray[])
_ZN4Prim1iEibcdfwPN4java4lang6StringEsx
Prim.i(int, boolean, byte, double, float, char, java.lang.String, short, long)
#
+--format=java
+_ZN4java4util14Map__U24_Entry11class__U24_E
+java.util.Map$Entry.class$
+#
--format=hp
_Utf58_0_1__1_2147483647__2147483648
_Utf58_0_1__1_2147483647__2147483648