summaryrefslogtreecommitdiffstats
path: root/lib/Support
diff options
context:
space:
mode:
authorFilip Pizlo <fpizlo@apple.com>2013-11-04 02:22:25 +0000
committerFilip Pizlo <fpizlo@apple.com>2013-11-04 02:22:25 +0000
commitfa0da86a59c502bfbfa01d3d5f694f18f6e8a717 (patch)
tree770dbb27d0618c91eca701bde217d71e3dd33e64 /lib/Support
parent4ebe64ae7ec729b29964b355face33af0c4ce424 (diff)
downloadexternal_llvm-fa0da86a59c502bfbfa01d3d5f694f18f6e8a717.zip
external_llvm-fa0da86a59c502bfbfa01d3d5f694f18f6e8a717.tar.gz
external_llvm-fa0da86a59c502bfbfa01d3d5f694f18f6e8a717.tar.bz2
Make the pretty stack trace be an opt-in, rather than opt-out, facility. Enable pretty
stack traces by default if you use PrettyStackTraceProgram, so that existing LLVM-based tools will continue to get it without any changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193971 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/PrettyStackTrace.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/lib/Support/PrettyStackTrace.cpp b/lib/Support/PrettyStackTrace.cpp
index d08abc8..722f4ca 100644
--- a/lib/Support/PrettyStackTrace.cpp
+++ b/lib/Support/PrettyStackTrace.cpp
@@ -28,10 +28,6 @@
using namespace llvm;
-namespace llvm {
- bool DisablePrettyStackTrace = false;
-}
-
static ManagedStatic<sys::ThreadLocal<const PrettyStackTraceEntry> > PrettyStackTraceHead;
static unsigned PrintStack(const PrettyStackTraceEntry *Entry, raw_ostream &OS){
@@ -103,17 +99,7 @@ static void CrashHandler(void *) {
#endif
}
-static bool RegisterCrashPrinter() {
- if (!DisablePrettyStackTrace)
- sys::AddSignalHandler(CrashHandler, 0);
- return false;
-}
-
PrettyStackTraceEntry::PrettyStackTraceEntry() {
- // The first time this is called, we register the crash printer.
- static bool HandlerRegistered = RegisterCrashPrinter();
- (void)HandlerRegistered;
-
// Link ourselves.
NextEntry = PrettyStackTraceHead->get();
PrettyStackTraceHead->set(this);
@@ -149,6 +135,17 @@ void PrettyStackTraceProgram::print(raw_ostream &OS) const {
OS << '\n';
}
-void LLVMDisablePrettyStackTrace() {
- DisablePrettyStackTrace = true;
+static bool RegisterCrashPrinter() {
+ sys::AddSignalHandler(CrashHandler, 0);
+ return false;
+}
+
+void llvm::EnablePrettyStackTrace() {
+ // The first time this is called, we register the crash printer.
+ static bool HandlerRegistered = RegisterCrashPrinter();
+ (void)HandlerRegistered;
+}
+
+void LLVMEnablePrettyStackTrace() {
+ EnablePrettyStackTrace();
}