diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-20 05:00:13 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-20 05:00:13 +0000 |
commit | 64e25ce53d6f533842271a593942258aadaca05b (patch) | |
tree | 93ecb9ff1dd76ec43bf4472a35a281e3e2f8e583 /compiler-rt/lib/ubsan | |
parent | fd633229f70c19213a450d9d932982041b870aca (diff) | |
download | bcm5719-llvm-64e25ce53d6f533842271a593942258aadaca05b.tar.gz bcm5719-llvm-64e25ce53d6f533842271a593942258aadaca05b.zip |
Move C++ name demangling support from ubsan into sanitizer_common.
llvm-svn: 170666
Diffstat (limited to 'compiler-rt/lib/ubsan')
-rw-r--r-- | compiler-rt/lib/ubsan/ubsan_diag.cc | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cc b/compiler-rt/lib/ubsan/ubsan_diag.cc index a726f4b55d9..8a31494a495 100644 --- a/compiler-rt/lib/ubsan/ubsan_diag.cc +++ b/compiler-rt/lib/ubsan/ubsan_diag.cc @@ -91,15 +91,6 @@ static void renderLocation(Location Loc) { } } -// C++ demangling function, as required by Itanium C++ ABI. This is weak, -// because we do not require a C++ ABI library to be linked to a program -// using UBSan; if it's not present, we'll just print the string mangled. -namespace __cxxabiv1 { - extern "C" char *__cxa_demangle(const char *mangled, char *buffer, - size_t *length, int *status) - __attribute__((weak)); -} - static void renderText(const char *Message, const Diag::Arg *Args) { for (const char *Msg = Message; *Msg; ++Msg) { if (*Msg != '%') { @@ -117,16 +108,8 @@ static void renderText(const char *Message, const Diag::Arg *Args) { Printf("%s", A.String); break; case Diag::AK_Mangled: { - const char *String = 0; - // FIXME: __cxa_demangle aggressively insists on allocating memory. - // There's not much we can do about that, short of providing our - // own demangler (libc++abi's implementation could easily be made - // to not allocate). For now, we just call it anyway, and we leak - // the returned value. - if (__cxxabiv1::__cxa_demangle) - String = __cxxabiv1::__cxa_demangle(A.String, 0, 0, 0); RawWrite("'"); - RawWrite(String ? String : A.String); + RawWrite(Demangle(A.String)); RawWrite("'"); break; } |