From 64e199473497769cf2d682a1ba4d6f29cb814a22 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Wed, 11 Oct 2017 16:46:53 +0900 Subject: [PATCH] fix testspr --- testspr/trace.hpp | 2 +- testspr/typeinfo.hpp | 43 ++++++++++++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/testspr/trace.hpp b/testspr/trace.hpp index 5e883e71..a59e0ebe 100644 --- a/testspr/trace.hpp +++ b/testspr/trace.hpp @@ -162,7 +162,7 @@ namespace testspr { return func_ == nullptr ? rhs == nullptr : rhs == nullptr ? false : func_.target_type() == rhs.target_type() - && func_.target() == rhs.target() + && func_.target() == rhs.target() ; } SPROUT_NON_CONSTEXPR bool operator!=(function_type const& rhs) const { diff --git a/testspr/typeinfo.hpp b/testspr/typeinfo.hpp index 410a60d2..1f2d427e 100644 --- a/testspr/typeinfo.hpp +++ b/testspr/typeinfo.hpp @@ -39,10 +39,10 @@ namespace testspr { }; // - // typename_of + // demangle // - namespace detail { #ifdef TESTSPR_HAS_CXXABI_H + namespace detail { inline SPROUT_NON_CONSTEXPR char* demangle_alloc(char const* name) { int status = 0; @@ -66,27 +66,40 @@ namespace testspr { return demangled_; } }; - inline SPROUT_NON_CONSTEXPR std::string - demangle(char const* name) { - scoped_demangled_name demangled(name); - return demangled.get() ? demangled.get() : name; - } -#else - inline SPROUT_NON_CONSTEXPR std::string - demangle(char const* name) { - return name; - } -#endif } // namespace detail + + inline SPROUT_NON_CONSTEXPR std::string + demangle(char const* name) { + testspr::detail::scoped_demangled_name demangled(name); + return demangled.get() ? demangled.get() : name; + } +#else + inline SPROUT_NON_CONSTEXPR std::string + demangle(char const* name) { + return name; + } +#endif + inline SPROUT_NON_CONSTEXPR std::string + demangle(std::string const& name) { + return testspr::demangle(name.c_str()); + } + + // + // typename_of + // + inline SPROUT_NON_CONSTEXPR std::string + typename_of(std::type_info const& t) { + return testspr::demangle(t.name()); + } template inline SPROUT_NON_CONSTEXPR std::string typename_of() { - return testspr::detail::demangle(typeid(T).name()); + return testspr::typename_of(typeid(T)); } template inline SPROUT_NON_CONSTEXPR std::string typename_of(T&& t) { - return testspr::detail::demangle(typeid(std::forward(t)).name()); + return testspr::typename_of(typeid(std::forward(t))); } //