> Fix this by adding a new DEMANGLE_COMPONENT_CONVERSION component type,
> which does what DEMANGLE_COMPONENT_CAST does today, and making
> DEMANGLE_COMPONENT_CAST just simply print its component subtree.
>
> I think we could instead reuse DEMANGLE_COMPONENT_CAST and in
> d_print_comp_inner still do:
>
>  @@ -5001,9 +5013,9 @@ d_print_comp_inner (struct d_print_info *dpi, int 
> options,
>         d_print_comp (dpi, options, dc->u.s_extended_operator.name);
>         return;
>
>      case DEMANGLE_COMPONENT_CAST:
>        d_append_string (dpi, "operator ");
>  -     d_print_cast (dpi, options, dc);
>  +     d_print_conversion (dpi, options, dc);
>        return;
>
> leaving the unary cast case below calling d_print_cast, but seems to
> me that spliting the component types makes it easier to reason about
> the code.

I agree.

> libiberty/
> 2014-05-27  Pedro Alves <pal...@redhat.com>
>
>         PR other/61321
>         PR other/61233
>         * demangle.h (enum demangle_component_type)
>         <DEMANGLE_COMPONENT_CONVERSION>: New value.
>         * cp-demangle.c (d_demangle_callback, d_make_comp): Handle
>         DEMANGLE_COMPONENT_CONVERSION.
>         (is_ctor_dtor_or_conversion): Handle DEMANGLE_COMPONENT_CONVERSION
>         instead of DEMANGLE_COMPONENT_CAST.
>         (d_operator_name): Return a DEMANGLE_COMPONENT_CONVERSION
>         component if handling a conversion.
>         (d_count_templates_scopes, d_print_comp_inner): Handle
>         DEMANGLE_COMPONENT_CONVERSION.
>         (d_print_comp_inner): Handle DEMANGLE_COMPONENT_CONVERSION instead
>         of DEMANGLE_COMPONENT_CAST.
>         (d_print_cast): Rename as ...
>         (d_print_conversion): ... this.  Adjust comments.
>         (d_print_cast): Rewrite - simply print the left subcomponent.
>         * cp-demint.c (cplus_demangle_fill_component): Handle
>         DEMANGLE_COMPONENT_CONVERSION.
>
>         * testsuite/demangle-expected: Add tests.

Looks good to me. Thanks!

Ian, does this look good to you?

-cary

Reply via email to