From 3ba112cece851984e6ff788b92bc11687e910788 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Mon, 2 Sep 2024 11:15:52 -0700 Subject: [PATCH] Better handling of failures in parse_name. --- include/boost/leaf/detail/demangle.hpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/boost/leaf/detail/demangle.hpp b/include/boost/leaf/detail/demangle.hpp index ff1d7a83..b197e42e 100644 --- a/include/boost/leaf/detail/demangle.hpp +++ b/include/boost/leaf/detail/demangle.hpp @@ -136,6 +136,14 @@ namespace leaf_detail } }; + // Workaround - we only use this function if parse_name (below) fails to parse __PRETTY_FUNCTION__ / __FUNCSIG__. + // In this case parse_name should be fixed to support the newly encountered (note, parsing is done at compile-time). + template + parsed_name please_update_parse_name() + { + return parsed_name(BOOST_LEAF_PRETTY_FUNCTION); + } + template parsed_name parse_name() { @@ -169,8 +177,8 @@ namespace leaf_detail BOOST_LEAF_PARSE_PF( "struct boost::leaf::parsed_name __fastcall boost::leaf::leaf_detail::parse_name(void)"); #undef BOOST_LEAF_PARSE_PF - // Unrecognized __PRETTY_FUNCTION__/__FUNSIG__ format, return as-is. Note, parsing is done at compile-time. - return parsed_name(BOOST_LEAF_PRETTY_FUNCTION); + // Unrecognized __PRETTY_FUNCTION__ / __FUNCSIG__ format, return as-is. Note, parsing is done at compile-time. + return please_update_parse_name(); } }