> Hello.
> 
> The patches makes a small refactoring in ipa-devirt.c and comes up
> with a handy debugging function debug_tree_odr_name.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2019-12-02  Martin Liska  <mli...@suse.cz>
> 
>       * ipa-devirt.c (warn_types_mismatch): Use get_odr_name_for_type.
>       * print-tree.c (debug_tree_odr_name): New.
>       * print-tree.h (debug_tree_odr_name): New.
>       * tree.h (get_odr_name_for_type): New.
> 
> gcc/testsuite/ChangeLog:
> 
> 2019-12-02  Martin Liska  <mli...@suse.cz>
> 
>       * g++.dg/lto/odr-7_0.C: New test.
>       * g++.dg/lto/odr-7_1.C: New test.

This is OK except ...
> +/* Print ODR name of a TYPE if available.
> +   Use demangler when option DEMANGLE is used.  */
> +
> +DEBUG_FUNCTION void
> +debug_tree_odr_name (tree type, bool demangle)

I would probably keep these in ipa-devirt since it has everything
related to devirtualization in it and there is not much related
to normal tree printing machinery.
> +/* If TYPE has mangled ODR name, return it.  Otherwise return NULL.  */
> +
> +inline const char *
> +get_odr_name_for_type (tree type)

Similarly here I would keep it in ipa-util where all the other ODR
related stuff is (next stage1 we could move it into something like
odr-type.[ch]).

Also document that it works only after free_lang_data was run.

Honza
> +{
> +  tree type_name = TYPE_NAME (type);
> +  if (type_name == NULL_TREE
> +      || !DECL_ASSEMBLER_NAME_SET_P (type_name))
> +    return NULL;
> +
> +  return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (type_name));
> +}
> +
>  /* A struct for encapsulating location information about an operator
>     and the operation built from it.
>  
> 

Reply via email to