diff options
Diffstat (limited to 'gnu/llvm/lib/Support/PrettyStackTrace.cpp')
| -rw-r--r-- | gnu/llvm/lib/Support/PrettyStackTrace.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/gnu/llvm/lib/Support/PrettyStackTrace.cpp b/gnu/llvm/lib/Support/PrettyStackTrace.cpp index a18e9cc5004..206de91ae23 100644 --- a/gnu/llvm/lib/Support/PrettyStackTrace.cpp +++ b/gnu/llvm/lib/Support/PrettyStackTrace.cpp @@ -1,10 +1,10 @@ //===- PrettyStackTrace.cpp - Pretty Crash Handling -----------------------===// -// +// // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines some helpful functions for dealing with the possibility of @@ -72,10 +72,10 @@ static void PrintStack(raw_ostream &OS) { static void PrintCurStackTrace(raw_ostream &OS) { // Don't print an empty trace. if (!PrettyStackTraceHead) return; - + // If there are pretty stack frames registered, walk and emit them. OS << "Stack dump:\n"; - + PrintStack(OS); OS.flush(); } @@ -85,10 +85,14 @@ static void PrintCurStackTrace(raw_ostream &OS) { // If any clients of llvm try to link to libCrashReporterClient.a themselves, // only one crash info struct will be used. extern "C" { -CRASH_REPORTER_CLIENT_HIDDEN -struct crashreporter_annotations_t gCRAnnotations - __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) +CRASH_REPORTER_CLIENT_HIDDEN +struct crashreporter_annotations_t gCRAnnotations + __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) +#if CRASHREPORTER_ANNOTATIONS_VERSION < 5 = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 }; +#else + = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0, 0 }; +#endif } #elif defined(__APPLE__) && HAVE_CRASHREPORTER_INFO extern "C" const char *__crashreporter_info__ @@ -110,17 +114,17 @@ static void CrashHandler(void *) { raw_svector_ostream Stream(TmpStr); PrintCurStackTrace(Stream); } - + if (!TmpStr.empty()) { #ifdef HAVE_CRASHREPORTERCLIENT_H // Cast to void to avoid warning. - (void)CRSetCrashLogMessage(std::string(TmpStr.str()).c_str()); -#elif HAVE_CRASHREPORTER_INFO - __crashreporter_info__ = strdup(std::string(TmpStr.str()).c_str()); + (void)CRSetCrashLogMessage(TmpStr.c_str()); +#elif HAVE_CRASHREPORTER_INFO + __crashreporter_info__ = strdup(TmpStr.c_str()); #endif errs() << TmpStr.str(); } - + #endif } |
