aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/Unix/Signals.inc
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2013-04-27 22:12:32 +0000
committerJoerg Sonnenberger <joerg@bec.de>2013-04-27 22:12:32 +0000
commitdfa0e92fa034019252305d62e42387bf6a758500 (patch)
tree5b3e84cf26719f2eef50a274f94672c56497d663 /lib/Support/Unix/Signals.inc
parentd999062f31b5e0a2f12d70a54ffdb02be8363657 (diff)
downloadexternal_llvm-dfa0e92fa034019252305d62e42387bf6a758500.zip
external_llvm-dfa0e92fa034019252305d62e42387bf6a758500.tar.gz
external_llvm-dfa0e92fa034019252305d62e42387bf6a758500.tar.bz2
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
Diffstat (limited to 'lib/Support/Unix/Signals.inc')
-rw-r--r--lib/Support/Unix/Signals.inc10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc
index 66338f1..1f8c815 100644
--- a/lib/Support/Unix/Signals.inc
+++ b/lib/Support/Unix/Signals.inc
@@ -27,9 +27,11 @@
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
-#if HAVE_DLFCN_H && __GNUG__
+#if HAVE_CXXABI_H
+#include cxxabi.h>
+#endif
+#if HAVE_DLFCN_H
#include <dlfcn.h>
-#include <cxxabi.h>
#endif
#if HAVE_MACH_MACH_H
#include <mach/mach.h>
@@ -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);