Only use cxxabi.h's demangler, if it is actually available.
authorJoerg Sonnenberger <joerg@bec.de>
Sat, 27 Apr 2013 22:12:32 +0000 (22:12 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Sat, 27 Apr 2013 22:12:32 +0000 (22:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180684 91177308-0d34-0410-b5e6-96231b3b80d8

autoconf/configure.ac
cmake/config-ix.cmake
configure
include/llvm/Config/config.h.cmake
include/llvm/Config/config.h.in
lib/Support/Unix/Signals.inc

index 9c116f7c00646ab8132b66bb28310ff9a0c26418..3101e9a5a16f2eefe894b3b0f20b2a2036203702 100644 (file)
@@ -1507,7 +1507,7 @@ AC_HEADER_STAT
 AC_HEADER_SYS_WAIT
 AC_HEADER_TIME
 
-AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
+AC_CHECK_HEADERS([cxxabi.h dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
 AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h])
 AC_CHECK_HEADERS([utime.h windows.h])
 AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h])
index 7c4285a299b25fc532523b33987caa1fcc86a33b..e5bcc0e9b11a28ed6c15e8976d92690f476649d9 100755 (executable)
@@ -37,6 +37,7 @@ endfunction()
 check_include_file(argz.h HAVE_ARGZ_H)
 check_include_file(assert.h HAVE_ASSERT_H)
 check_include_file(ctype.h HAVE_CTYPE_H)
+check_include_file(cxxabi.h HAVE_CXXABI_H)
 check_include_file(dirent.h HAVE_DIRENT_H)
 check_include_file(dl.h HAVE_DL_H)
 check_include_file(dld.h HAVE_DLD_H)
index 26b612d2799a50d5c1800ab82d8ca1a4c8fd68ea..4e146189e6fd5d5bdc6982e94b2be81d7a5c6e28 100755 (executable)
--- a/configure
+++ b/configure
@@ -14868,7 +14868,7 @@ fi
 
 
 
-for ac_header in dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h
+for ac_header in cxxabi.h dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
index 97af6955d9edd6c9b201c39ec459217a4c04bd34..93c2582ae23526ed582c6f2c00717f1304c44b70 100644 (file)
@@ -69,6 +69,9 @@
 /* Define to 1 if you have the `closedir' function. */
 #cmakedefine HAVE_CLOSEDIR ${HAVE_CLOSEDIR}
 
+/* Define to 1 if you have the <cxxabi.h> header file. */
+#cmakedefine HAVE_CXXABI_H ${HAVE_CXXABI_H}
+
 /* Define to 1 if you have the <CrashReporterClient.h> header file. */
 #undef HAVE_CRASHREPORTERCLIENT_H
 
index 7f75f4df69c4c9b0516c62e2ac1565cdf97000ea..0cffd0febecd5336adc7df433b52e47059fec7fe 100644 (file)
@@ -69,6 +69,9 @@
 /* Define to 1 if you have the `closedir' function. */
 #undef HAVE_CLOSEDIR
 
+/* Define to 1 if you have the <cxxabi.h> header file. */
+#undef HAVE_CXXABI_H
+
 /* Define to 1 if you have the <CrashReporterClient.h> header file. */
 #undef HAVE_CRASHREPORTERCLIENT_H
 
index 66338f17d88fac41dc189fd46f4a91d02a75eee7..1f8c8158d7f30586e47071a46cab22d0d5636f85 100644 (file)
 #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);