From dfa0e92fa034019252305d62e42387bf6a758500 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Sat, 27 Apr 2013 22:12:32 +0000 Subject: Only use cxxabi.h's demangler, if it is actually available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180684 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/Unix/Signals.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/Support/Unix/Signals.inc') diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc index 66338f17d8..1f8c8158d7 100644 --- a/lib/Support/Unix/Signals.inc +++ b/lib/Support/Unix/Signals.inc @@ -27,9 +27,11 @@ #if HAVE_SYS_STAT_H #include #endif -#if HAVE_DLFCN_H && __GNUG__ +#if HAVE_CXXABI_H +#include cxxabi.h> +#endif +#if HAVE_DLFCN_H #include -#include #endif #if HAVE_MACH_MACH_H #include @@ -292,7 +294,11 @@ void llvm::sys::PrintStackTrace(FILE *FD) { if (dlinfo.dli_sname != NULL) { int res; fputc(' ', FD); +# if HAVE_CXXABI_H char* d = abi::__cxa_demangle(dlinfo.dli_sname, NULL, NULL, &res); +# else + char* d = NULL; +# endif if (d == NULL) fputs(dlinfo.dli_sname, FD); else fputs(d, FD); free(d); -- cgit v1.2.3