mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 21:24:28 +00:00
29 lines
487 B
C++
29 lines
487 B
C++
|
#include <Common/demangle.h>
|
||
|
#include <cxxabi.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
|
||
|
std::string demangle(const char * name, int & status)
|
||
|
{
|
||
|
std::string res;
|
||
|
|
||
|
char * demangled_str = abi::__cxa_demangle(name, 0, 0, &status);
|
||
|
if (demangled_str)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
res = demangled_str;
|
||
|
}
|
||
|
catch (...)
|
||
|
{
|
||
|
free(demangled_str);
|
||
|
throw;
|
||
|
}
|
||
|
free(demangled_str);
|
||
|
}
|
||
|
else
|
||
|
res = name;
|
||
|
|
||
|
return res;
|
||
|
}
|