mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09: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: c600280dde
1 changed files with 7 additions and 0 deletions
|
@ -27,18 +27,25 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
|
|
||||||
|
#ifndef SERENITY_LIBC_BUILD
|
||||||
#include <cxxabi.h>
|
#include <cxxabi.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
inline String demangle(const StringView& name)
|
inline String demangle(const StringView& name)
|
||||||
{
|
{
|
||||||
|
#ifdef SERENITY_LIBC_BUILD
|
||||||
|
return name;
|
||||||
|
#else
|
||||||
int status = 0;
|
int status = 0;
|
||||||
auto* demangled_name = abi::__cxa_demangle(String(name).characters(), nullptr, nullptr, &status);
|
auto* demangled_name = abi::__cxa_demangle(String(name).characters(), nullptr, nullptr, &status);
|
||||||
auto string = String(status == 0 ? demangled_name : name);
|
auto string = String(status == 0 ? demangled_name : name);
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
kfree(demangled_name);
|
kfree(demangled_name);
|
||||||
return string;
|
return string;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue