summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm-c/Core.h6
-rw-r--r--llvm/lib/Support/PrettyStackTrace.cpp5
2 files changed, 11 insertions, 0 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 690ffa9fdc4..47d566c03e2 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -434,6 +434,12 @@ void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler);
void LLVMResetFatalErrorHandler(void);
/**
+ * Disable LLVM's built-in stack trace code. This must be called before any
+ * other LLVM APIs; otherwise the results are undefined.
+ */
+void LLVMDisablePrettyStackTrace(void);
+
+/**
* @defgroup LLVMCCoreContext Contexts
*
* Contexts are execution states for the core LLVM IR system.
diff --git a/llvm/lib/Support/PrettyStackTrace.cpp b/llvm/lib/Support/PrettyStackTrace.cpp
index 315008ae810..d08abc8ce15 100644
--- a/llvm/lib/Support/PrettyStackTrace.cpp
+++ b/llvm/lib/Support/PrettyStackTrace.cpp
@@ -20,6 +20,7 @@
#include "llvm/Support/ThreadLocal.h"
#include "llvm/Support/Watchdog.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm-c/Core.h"
#ifdef HAVE_CRASHREPORTERCLIENT_H
#include <CrashReporterClient.h>
@@ -147,3 +148,7 @@ void PrettyStackTraceProgram::print(raw_ostream &OS) const {
OS << ArgV[i] << ' ';
OS << '\n';
}
+
+void LLVMDisablePrettyStackTrace() {
+ DisablePrettyStackTrace = true;
+}
OpenPOWER on IntegriCloud