unwind_base_impls.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright Antony Polukhin, 2016-2021.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_STACKTRACE_DETAIL_UNWIND_BASE_IMPLS_HPP
  7. #define BOOST_STACKTRACE_DETAIL_UNWIND_BASE_IMPLS_HPP
  8. #include <boost/config.hpp>
  9. #ifdef BOOST_HAS_PRAGMA_ONCE
  10. # pragma once
  11. #endif
  12. #include <boost/stacktrace/frame.hpp>
  13. namespace boost { namespace stacktrace { namespace detail {
  14. struct to_string_using_nothing {
  15. std::string res;
  16. void prepare_function_name(const void* addr) {
  17. res = boost::stacktrace::frame(addr).name();
  18. }
  19. bool prepare_source_location(const void* /*addr*/) const BOOST_NOEXCEPT {
  20. return false;
  21. }
  22. };
  23. template <class Base> class to_string_impl_base;
  24. typedef to_string_impl_base<to_string_using_nothing> to_string_impl;
  25. inline std::string name_impl(const void* /*addr*/) {
  26. return std::string();
  27. }
  28. } // namespace detail
  29. std::string frame::source_file() const {
  30. return std::string();
  31. }
  32. std::size_t frame::source_line() const {
  33. return 0;
  34. }
  35. }} // namespace boost::stacktrace
  36. #endif // BOOST_STACKTRACE_DETAIL_UNWIND_BASE_IMPLS_HPP