X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=libiberty%2Fcp-demint.c;h=950e4dc5522af08d65131ee8a766c0317ff7c770;hb=f65fe5704af56aca58fd5547d0841a9512e540af;hp=833e89e7a90c35d1fa457eb2b137fc7871a2a6ae;hpb=5972747385e9727b46e50d4992fecbdd8bcf8106;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/cp-demint.c b/libiberty/cp-demint.c index 833e89e7a9..950e4dc552 100644 --- a/libiberty/cp-demint.c +++ b/libiberty/cp-demint.c @@ -1,5 +1,5 @@ /* Demangler component interface functions. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004-2019 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of the libiberty library, which is part of GCC. @@ -25,7 +25,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file implements a few interface functions which are provided @@ -56,11 +56,10 @@ /* Fill in most component types. */ int -cplus_demangle_fill_component (p, type, left, right) - struct demangle_component *p; - enum demangle_component_type type; - struct demangle_component *left; - struct demangle_component *right; +cplus_demangle_fill_component (struct demangle_component *p, + enum demangle_component_type type, + struct demangle_component *left, + struct demangle_component *right) { if (p == NULL) return 0; @@ -70,6 +69,7 @@ cplus_demangle_fill_component (p, type, left, right) case DEMANGLE_COMPONENT_LOCAL_NAME: case DEMANGLE_COMPONENT_TYPED_NAME: case DEMANGLE_COMPONENT_TEMPLATE: + case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE: case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: case DEMANGLE_COMPONENT_FUNCTION_TYPE: case DEMANGLE_COMPONENT_ARRAY_TYPE: @@ -89,7 +89,6 @@ cplus_demangle_fill_component (p, type, left, right) /* These component types only have one subtree. */ case DEMANGLE_COMPONENT_VTABLE: case DEMANGLE_COMPONENT_VTT: - case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE: case DEMANGLE_COMPONENT_TYPEINFO: case DEMANGLE_COMPONENT_TYPEINFO_NAME: case DEMANGLE_COMPONENT_TYPEINFO_FN: @@ -107,10 +106,12 @@ cplus_demangle_fill_component (p, type, left, right) case DEMANGLE_COMPONENT_CONST_THIS: case DEMANGLE_COMPONENT_POINTER: case DEMANGLE_COMPONENT_REFERENCE: + case DEMANGLE_COMPONENT_RVALUE_REFERENCE: case DEMANGLE_COMPONENT_COMPLEX: case DEMANGLE_COMPONENT_IMAGINARY: case DEMANGLE_COMPONENT_VENDOR_TYPE: case DEMANGLE_COMPONENT_CAST: + case DEMANGLE_COMPONENT_CONVERSION: if (right != NULL) return 0; break; @@ -123,6 +124,7 @@ cplus_demangle_fill_component (p, type, left, right) p->type = type; p->u.s_binary.left = left; p->u.s_binary.right = right; + p->d_printing = 0; return 1; } @@ -130,23 +132,23 @@ cplus_demangle_fill_component (p, type, left, right) /* Fill in a DEMANGLE_COMPONENT_BUILTIN_TYPE. */ int -cplus_demangle_fill_builtin_type (p, typename) - struct demangle_component *p; - const char *typename; +cplus_demangle_fill_builtin_type (struct demangle_component *p, + const char *type_name) { int len; unsigned int i; - if (p == NULL || typename == NULL) + if (p == NULL || type_name == NULL) return 0; - len = strlen (typename); + len = strlen (type_name); for (i = 0; i < D_BUILTIN_TYPE_COUNT; ++i) { if (len == cplus_demangle_builtin_types[i].len - && strcmp (typename, cplus_demangle_builtin_types[i].name) == 0) + && strcmp (type_name, cplus_demangle_builtin_types[i].name) == 0) { p->type = DEMANGLE_COMPONENT_BUILTIN_TYPE; p->u.s_builtin.type = &cplus_demangle_builtin_types[i]; + p->d_printing = 0; return 1; } } @@ -156,10 +158,8 @@ cplus_demangle_fill_builtin_type (p, typename) /* Fill in a DEMANGLE_COMPONENT_OPERATOR. */ int -cplus_demangle_fill_operator (p, opname, args) - struct demangle_component *p; - const char *opname; - int args; +cplus_demangle_fill_operator (struct demangle_component *p, + const char *opname, int args) { int len; unsigned int i; @@ -175,6 +175,7 @@ cplus_demangle_fill_operator (p, opname, args) { p->type = DEMANGLE_COMPONENT_OPERATOR; p->u.s_operator.op = &cplus_demangle_operators[i]; + p->d_printing = 0; return 1; } } @@ -184,10 +185,7 @@ cplus_demangle_fill_operator (p, opname, args) /* Translate a mangled name into components. */ struct demangle_component * -cplus_demangle_v3_components (mangled, options, mem) - const char *mangled; - int options; - void **mem; +cplus_demangle_v3_components (const char *mangled, int options, void **mem) { size_t len; int type; @@ -213,10 +211,8 @@ cplus_demangle_v3_components (mangled, options, mem) malloc (di.num_subs * sizeof (struct demangle_component *))); if (di.comps == NULL || di.subs == NULL) { - if (di.comps != NULL) - free (di.comps); - if (di.subs != NULL) - free (di.subs); + free (di.comps); + free (di.subs); return NULL; }