Message ID | 20240807154026.11510-1-peter0x44@disroot.org |
---|---|
State | New |
Headers | show |
Series | [v2] diagnostics: Follow DECL_ORIGIN in lhd_print_error_function [PR102061] | expand |
I forgot to state what changed in the v2. Now, following the DECL_ORIGIN is done in lhd_print_error_function instead of lhd_decl_printable_name because lhd_decl_printable_name was used in other circumstances, like dumping RTL. This caused test failures.
diff --git a/gcc/langhooks.cc b/gcc/langhooks.cc index 61f2b676256..ab5f0932310 100644 --- a/gcc/langhooks.cc +++ b/gcc/langhooks.cc @@ -395,6 +395,8 @@ lhd_print_error_function (diagnostic_context *context, const char *file, else fndecl = current_function_decl; + fndecl = DECL_ORIGIN(fndecl); + if (TREE_CODE (TREE_TYPE (fndecl)) == METHOD_TYPE) pp_printf (context->printer, _("In member function %qs"),
Currently, if a warning references a cloned function, the name of the cloned function will be emitted in the "In function %qs" part of the diagnostic, which users aren't supposed to see. This patch follows the DECL_ORIGIN link to get the name of the original function. gcc/ChangeLog: PR diagnostics/102061 * langhooks.cc (lhd_print_error_function): Follow DECL_ORIGIN link Signed-off-by: Peter Damianov <peter0x44@disroot.org> --- I struggled to write a testcase for this, as none of the real world cases I tried reduced to anything nice. Hopefully it's okay to skip it at this time. gcc/langhooks.cc | 2 ++ 1 file changed, 2 insertions(+)