0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-13 21:41:06 +01:00

ircd: Move demangle() out of util.

This commit is contained in:
Jason Volk 2019-09-19 16:37:18 -07:00
parent 26cd9cec85
commit 71a56fecb7
2 changed files with 10 additions and 11 deletions

View file

@ -11,8 +11,7 @@
#pragma once #pragma once
#define HAVE_IRCD_DEMANGLE_H #define HAVE_IRCD_DEMANGLE_H
namespace ircd { namespace ircd
inline namespace util
{ {
IRCD_EXCEPTION(ircd::error, demangle_error) IRCD_EXCEPTION(ircd::error, demangle_error)
IRCD_EXCEPTION(demangle_error, not_mangled) IRCD_EXCEPTION(demangle_error, not_mangled)
@ -23,18 +22,18 @@ inline namespace util
std::string demangle(const char *const &symbol); std::string demangle(const char *const &symbol);
template<class T> string_view demangle(const mutable_buffer &out); template<class T> string_view demangle(const mutable_buffer &out);
template<class T> std::string demangle(); template<class T> std::string demangle();
}} }
template<class T> template<class T>
std::string std::string
ircd::util::demangle() ircd::demangle()
{ {
return demangle(typeid(T).name()); return demangle(typeid(T).name());
} }
template<class T> template<class T>
ircd::string_view ircd::string_view
ircd::util::demangle(const mutable_buffer &out) ircd::demangle(const mutable_buffer &out)
{ {
return demangle(out, typeid(T).name()); return demangle(out, typeid(T).name());
} }

View file

@ -14,7 +14,7 @@ thread_local char
outbuf[8192]; outbuf[8192];
std::string std::string
ircd::util::demangle(const char *const &symbol) ircd::demangle(const char *const &symbol)
{ {
const string_view demangled const string_view demangled
{ {
@ -25,7 +25,7 @@ ircd::util::demangle(const char *const &symbol)
} }
std::string std::string
ircd::util::demangle(const string_view &symbol) ircd::demangle(const string_view &symbol)
{ {
const string_view demangled const string_view demangled
{ {
@ -36,8 +36,8 @@ ircd::util::demangle(const string_view &symbol)
} }
ircd::string_view ircd::string_view
ircd::util::demangle(const mutable_buffer &out, ircd::demangle(const mutable_buffer &out,
const string_view &symbol_) const string_view &symbol_)
{ {
assert(size(symbol_) < 4096); assert(size(symbol_) < 4096);
thread_local char symbuf[8192]; thread_local char symbuf[8192];
@ -50,8 +50,8 @@ ircd::util::demangle(const mutable_buffer &out,
} }
ircd::string_view ircd::string_view
ircd::util::demangle(const mutable_buffer &out, ircd::demangle(const mutable_buffer &out,
const char *const &symbol) const char *const &symbol)
{ {
int status(0); int status(0);
size_t len(size(out)); size_t len(size(out));