Skip to content

Commit

Permalink
Better handling of failures in parse_name.
Browse files Browse the repository at this point in the history
  • Loading branch information
zajo committed Sep 2, 2024
1 parent 68bf3a8 commit 3ba112c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions include/boost/leaf/detail/demangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class Name>
parsed_name please_update_parse_name()
{
return parsed_name(BOOST_LEAF_PRETTY_FUNCTION);
}

template <class Name>
parsed_name parse_name()
{
Expand Down Expand Up @@ -169,8 +177,8 @@ namespace leaf_detail
BOOST_LEAF_PARSE_PF( "struct boost::leaf::parsed_name __fastcall boost::leaf::leaf_detail::parse_name<enum ", ">(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<Name>();
}
}

Expand Down

0 comments on commit 3ba112c

Please sign in to comment.