diff options
author | David Chisnall <theraven@theravensnest.org> | 2011-05-21 11:02:45 +0000 |
---|---|---|
committer | David Chisnall <theraven@theravensnest.org> | 2011-05-21 11:02:45 +0000 |
commit | 958237cf33ae913f7d2e995d48d1f8fdccec5e5b (patch) | |
tree | 81edbabbec82155d08c2f06d374ebc74b9076b21 /src/typeinfo.cc | |
parent | a9294e6ba541c8e5f3e788538608ee9ec7b595df (diff) | |
download | libcxxrt-958237cf33ae913f7d2e995d48d1f8fdccec5e5b.tar.gz libcxxrt-958237cf33ae913f7d2e995d48d1f8fdccec5e5b.tar.bz2 libcxxrt-958237cf33ae913f7d2e995d48d1f8fdccec5e5b.tar.xz |
Replaced libelftc's demangler with the one from libc++abi.
Diffstat (limited to 'src/typeinfo.cc')
-rw-r--r-- | src/typeinfo.cc | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/typeinfo.cc b/src/typeinfo.cc index b0deb8b..bd12a00 100644 --- a/src/typeinfo.cc +++ b/src/typeinfo.cc @@ -43,54 +43,3 @@ ABI_NAMESPACE::__pbase_type_info::~__pbase_type_info() {} ABI_NAMESPACE::__pointer_type_info::~__pointer_type_info() {} ABI_NAMESPACE::__pointer_to_member_type_info::~__pointer_to_member_type_info() {} -// From libelftc -extern "C" char *__cxa_demangle_gnu3(const char *); - -/** - * Demangles a C++ symbol or type name. The buffer, if non-NULL, must be - * allocated with malloc() and must be *n bytes or more long. This function - * may call realloc() on the value pointed to by buf, and will return the - * length of the string via *n. - * - * The value pointed to by status is set to one of the following: - * - * 0: success - * -1: memory allocation failure - * -2: invalid mangled name - * -3: invalid arguments - */ -extern "C" char* __cxa_demangle(const char* mangled_name, - char* buf, - size_t* n, - int* status) -{ - // TODO: We should probably just be linking against libelf-tc, rather than - // copying their code. This requires them to do an actual release, - // however, and for our changes to be pushed upstream. We also need to - // call a different demangling function here depending on the ABI (e.g. - // ARM). - char *demangled = __cxa_demangle_gnu3(mangled_name); - if (NULL != demangled) - { - size_t len = strlen(demangled); - buf = (char*)realloc(buf, len+1); - if (0 != buf) - { - memcpy(buf, demangled, len); - buf[len] = 0; - *n = len; - *status = 0; - } - else - { - *status = -1; - } - free(demangled); - } - else - { - *status = -2; - return NULL; - } - return buf; -} |