mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
c24fe710d7
For some reason, the default CXXFLAGS and such don't get us the __cxa_demangle symbol in userland.
24 lines
422 B
C++
24 lines
422 B
C++
#pragma once
|
|
|
|
#include <AK/String.h>
|
|
#include <cxxabi.h>
|
|
|
|
namespace AK {
|
|
|
|
inline String demangle(const char* name)
|
|
{
|
|
#ifdef KERNEL
|
|
int status = 0;
|
|
auto* demangled_name = abi::__cxa_demangle(name, nullptr, nullptr, &status);
|
|
auto string = String(status == 0 ? demangled_name : name);
|
|
if (status == 0)
|
|
kfree(demangled_name);
|
|
return string;
|
|
#else
|
|
return name;
|
|
#endif
|
|
}
|
|
|
|
}
|
|
|
|
using AK::demangle;
|