Currently, if a warning references a cloned function, the name of the cloned
function will be emitted in the "In function 'xyz'" 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_decl_printable_name): Follow DECL_ORIGIN
link
Signed-off-by: Peter Damianov <[email protected]>
---
v2: use DECL_ORIGIN instead of DECL_ABSTRACT_ORIGIN and remove loop
gcc/langhooks.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/gcc/langhooks.cc b/gcc/langhooks.cc
index 61f2b676256..943b8345a95 100644
--- a/gcc/langhooks.cc
+++ b/gcc/langhooks.cc
@@ -223,6 +223,7 @@ lhd_get_alias_set (tree ARG_UNUSED (t))
const char *
lhd_decl_printable_name (tree decl, int ARG_UNUSED (verbosity))
{
+ decl = DECL_ORIGIN(decl);
gcc_assert (decl && DECL_NAME (decl));
return IDENTIFIER_POINTER (DECL_NAME (decl));
}
--
2.39.2