mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: The <cxxabi.h> header is not available during Toolchain build
This will need some refinement, but basically since we build LibC during the toolchain build, we don't have libstdc++ headers yet.
This commit is contained in:
parent
9dc78338ad
commit
c600280dde
Notes:
sideshowbarker
2024-07-19 09:41:13 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c600280ddec
1 changed files with 7 additions and 0 deletions
|
@ -27,18 +27,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
|
||||
#ifndef SERENITY_LIBC_BUILD
|
||||
#include <cxxabi.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
||||
inline String demangle(const StringView& name)
|
||||
{
|
||||
#ifdef SERENITY_LIBC_BUILD
|
||||
return name;
|
||||
#else
|
||||
int status = 0;
|
||||
auto* demangled_name = abi::__cxa_demangle(String(name).characters(), nullptr, nullptr, &status);
|
||||
auto string = String(status == 0 ? demangled_name : name);
|
||||
if (status == 0)
|
||||
kfree(demangled_name);
|
||||
return string;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue