diff options
author | samuel <samuel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-23 17:55:13 +0000 |
---|---|---|
committer | samuel <samuel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-23 17:55:13 +0000 |
commit | 65bcf503de49123432d4f9ff8344af729b738bb5 (patch) | |
tree | 225c1ff7f39e01bde48586dfc91961fc01b13b7f /libiberty | |
parent | caffec04ede14a21b1b553057b0586c1d06c3dbd (diff) | |
download | gcc-65bcf503de49123432d4f9ff8344af729b738bb5.tar.gz |
* cp-demangle.c (demangle_ctor_dtor_name): Remove not-in-charge
allocating ctor mangling.
(demangle_array_type): Handle empty and non-constant array length.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35210 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 6 | ||||
-rw-r--r-- | libiberty/cp-demangle.c | 49 |
2 files changed, 40 insertions, 15 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index a97b43a4b8b..feee6424513 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2000-07-21 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (demangle_ctor_dtor_name): Remove not-in-charge + allocating ctor mangling. + (demangle_array_type): Handle empty and non-constant array length. + 2000-07-23 Michael Sokolov <msokolov@ivan.Harhan.ORG> * aclocal.m4 (libiberty_AC_DECLARE_ERRNO): New macro. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index f95dc71d8f9..a2c326106b6 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1738,7 +1738,6 @@ demangle_special_name (dm) ::= C1 # complete object (in-charge) ctor ::= C2 # base object (not-in-charge) ctor ::= C3 # complete object (in-charge) allocating ctor - ::= C4 # base object (not-in-charge) allocating ctor ::= D0 # deleting (in-charge) dtor ::= D1 # complete object (in-charge) dtor ::= D2 # base object (not-in-charge) dtor */ @@ -1751,8 +1750,7 @@ demangle_ctor_dtor_name (dm) { "in-charge", "not-in-charge", - "in-charge allocating", - "not-in-charge allocating" + "allocating" }; static const char *const dtor_flavors[] = { @@ -1770,7 +1768,7 @@ demangle_ctor_dtor_name (dm) { /* A constructor name. Consume the C. */ advance_char (dm); - if (peek_char (dm) < '1' || peek_char (dm) > '4') + if (peek_char (dm) < '1' || peek_char (dm) > '3') return "Unrecognized constructor."; RETURN_IF_ERROR (result_append_string (dm, dm->last_source_name)); /* Print the flavor of the constructor if in verbose mode. */ @@ -2312,23 +2310,43 @@ demangle_class_enum_type (dm, template_p) /* Demangles and emits an <array-type>. - <array-type> ::= A [<dimension number>] _ <element type> */ + <array-type> ::= A [<dimension number>] _ <element type> + ::= A <dimension expression> _ <element type> */ static status_t demangle_array_type (dm) demangling_t dm; { - status_t status; - dyn_string_t array_size = dyn_string_new (10); - - if (array_size == NULL) - return STATUS_ALLOCATION_FAILED; + status_t status = STATUS_OK; + dyn_string_t array_size = NULL; + char peek; - status = demangle_char (dm, 'A'); + RETURN_IF_ERROR (demangle_char (dm, 'A')); /* Demangle the array size into array_size. */ - if (STATUS_NO_ERROR (status)) - status = demangle_number_literally (dm, array_size, 10, 0); + peek = peek_char (dm); + if (peek == '_') + /* Array bound is omitted. This is a C99-style VLA. */ + ; + else if (IS_DIGIT (peek_char (dm))) + { + /* It looks like a constant array bound. */ + array_size = dyn_string_new (10); + if (array_size == NULL) + return STATUS_ALLOCATION_FAILED; + status = demangle_number_literally (dm, array_size, 10, 0); + } + else + { + /* Anything is must be an expression for a nont-constant array + bound. This happens if the array type occurs in a template + and the array bound references a template parameter. */ + RETURN_IF_ERROR (result_push (dm)); + RETURN_IF_ERROR (demangle_expression (dm)); + array_size = (dyn_string_t) result_pop (dm); + } + /* array_size may have been allocated by now, so we can't use + RETURN_IF_ERROR until it's been deallocated. */ /* Demangle the base type of the array. */ if (STATUS_NO_ERROR (status)) @@ -2339,11 +2357,12 @@ demangle_array_type (dm) /* Emit the array dimension syntax. */ if (STATUS_NO_ERROR (status)) status = result_append_char (dm, '['); - if (STATUS_NO_ERROR (status)) + if (STATUS_NO_ERROR (status) && array_size != NULL) status = result_append_string (dm, array_size); if (STATUS_NO_ERROR (status)) status = result_append_char (dm, ']'); - dyn_string_delete (array_size); + if (array_size != NULL) + dyn_string_delete (array_size); RETURN_IF_ERROR (status); |