This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/3] PR other/61321 - demangler crash on casts in template parameters
- From: Ian Lance Taylor <iant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>, Jason Merrill <jason at redhat dot com>
- Cc: Pedro Alves <palves at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 30 May 2014 11:05:14 -0700
- Subject: Re: [PATCH 2/3] PR other/61321 - demangler crash on casts in template parameters
- Authentication-results: sourceware.org; auth=none
- References: <1401191856-27585-1-git-send-email-palves at redhat dot com> <1401191856-27585-3-git-send-email-palves at redhat dot com> <CAHACq4rB4hFWj9ouX_+3yxVfpFiiwVNFXCDTyTKJxi01=MmiYQ at mail dot gmail dot com>
On Fri, May 30, 2014 at 10:37 AM, Cary Coutant <ccoutant@google.com> wrote:
>> 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 <palves@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?
I tend to defer to Jason on this sort of newfangled mangling
nuttiness, but I can take a look if he doesn't have time.
Ian