mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
This adds a copy of the demangler in libcxxabi.
The code also has no dependencies on anything else in LLVM. To enforce
that I added it as another library. That way a BUILD_SHARED_LIBS will
fail if anyone adds an use of StringRef for example.
The no llvm dependency combined with the fact that this has to build
on linux, OS X and Windows required a few changes to the code. In
particular:
No constexpr.
No alignas
On OS X at least this library has only one global symbol:
__ZN4llvm16itanium_demangleEPKcPcPmPi
My current plan is:
Commit something like this
Change lld to use it
Change lldb to use it as the fallback
Add a few #ifdefs so that exactly the same file can be used in
libcxxabi to export abi::__cxa_demangle.
Once the fast demangler in lldb can handle any names this
implementation can be replaced with it and we will have the one true
demangler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280732 91177308-0d34-0410-b5e6-96231b3b80d8
29 lines
905 B
C++
29 lines
905 B
C++
//===--- Demangle.h ---------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include <cstddef>
|
|
|
|
namespace llvm {
|
|
/// This is a llvm local version of __cxa_demangle. Other than the name and
|
|
/// being in the llvm namespace it is identical.
|
|
///
|
|
/// The mangled_name is demangled into buf and returned. If the buffer is not
|
|
/// large enough, realloc is used to expand it.
|
|
///
|
|
/// The *status will be set to
|
|
/// unknown_error: -4
|
|
/// invalid_args: -3
|
|
/// invalid_mangled_name: -2
|
|
/// memory_alloc_failure: -1
|
|
/// success: 0
|
|
|
|
char *itaniumDemangle(const char *mangled_name, char *buf, size_t *n,
|
|
int *status);
|
|
}
|