hot chocolate
parent
da891be991
commit
8defbaf70d
|
@ -26,22 +26,28 @@
|
||||||
#include <blt/compatibility.h>
|
#include <blt/compatibility.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace blt
|
||||||
|
{
|
||||||
static BLT_CPP20_CONSTEXPR inline std::string demangle(const std::string& str)
|
static BLT_CPP20_CONSTEXPR inline std::string demangle(const std::string& str)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
// only defined for GNU C++11?
|
// only defined for GNU C++11?
|
||||||
char *demangled_name = abi::__cxa_demangle(str.c_str(), nullptr, nullptr, &status);
|
char* demangled_name = abi::__cxa_demangle(str.c_str(), nullptr, nullptr, &status);
|
||||||
if (demangled_name == nullptr)
|
if (demangled_name == nullptr)
|
||||||
return str;
|
return str;
|
||||||
std::string ret_name = demangled_name;
|
std::string ret_name = demangled_name;
|
||||||
std::free(demangled_name);
|
std::free(demangled_name);
|
||||||
return ret_name;
|
return ret_name;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
namespace blt
|
||||||
|
{
|
||||||
static BLT_CPP20_CONSTEXPR inline std::string demangle(const std::string& str)
|
static BLT_CPP20_CONSTEXPR inline std::string demangle(const std::string& str)
|
||||||
{
|
{
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace blt
|
namespace blt
|
||||||
|
|
Loading…
Reference in New Issue