Fix the preprocessor checks used to determine if backtraces have been enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227424 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2015-01-29 07:53:13 +00:00
parent e9cc6bd43f
commit b326bdc595

View File

@ -30,7 +30,7 @@ using namespace llvm;
// If backtrace support is not enabled, compile out support for pretty stack // If backtrace support is not enabled, compile out support for pretty stack
// traces. This has the secondary effect of not requiring thread local storage // traces. This has the secondary effect of not requiring thread local storage
// when backtrace support is disabled. // when backtrace support is disabled.
#if ENABLE_BACKTRACE #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
// We need a thread local pointer to manage the stack of our stack trace // We need a thread local pointer to manage the stack of our stack trace
// objects, but we *really* cannot tolerate destructors running and do not want // objects, but we *really* cannot tolerate destructors running and do not want
@ -108,11 +108,11 @@ static void CrashHandler(void *) {
#endif #endif
} }
// ENABLE_BACKTRACE // defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
#endif #endif
PrettyStackTraceEntry::PrettyStackTraceEntry() { PrettyStackTraceEntry::PrettyStackTraceEntry() {
#if ENABLE_BACKTRACE #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
// Link ourselves. // Link ourselves.
NextEntry = PrettyStackTraceHead; NextEntry = PrettyStackTraceHead;
PrettyStackTraceHead = this; PrettyStackTraceHead = this;
@ -120,7 +120,7 @@ PrettyStackTraceEntry::PrettyStackTraceEntry() {
} }
PrettyStackTraceEntry::~PrettyStackTraceEntry() { PrettyStackTraceEntry::~PrettyStackTraceEntry() {
#if ENABLE_BACKTRACE #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
assert(PrettyStackTraceHead == this && assert(PrettyStackTraceHead == this &&
"Pretty stack trace entry destruction is out of order"); "Pretty stack trace entry destruction is out of order");
PrettyStackTraceHead = getNextEntry(); PrettyStackTraceHead = getNextEntry();
@ -139,7 +139,7 @@ void PrettyStackTraceProgram::print(raw_ostream &OS) const {
OS << '\n'; OS << '\n';
} }
#if ENABLE_BACKTRACE #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
static bool RegisterCrashPrinter() { static bool RegisterCrashPrinter() {
sys::AddSignalHandler(CrashHandler, nullptr); sys::AddSignalHandler(CrashHandler, nullptr);
return false; return false;
@ -147,7 +147,7 @@ static bool RegisterCrashPrinter() {
#endif #endif
void llvm::EnablePrettyStackTrace() { void llvm::EnablePrettyStackTrace() {
#if ENABLE_BACKTRACE #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
// The first time this is called, we register the crash printer. // The first time this is called, we register the crash printer.
static bool HandlerRegistered = RegisterCrashPrinter(); static bool HandlerRegistered = RegisterCrashPrinter();
(void)HandlerRegistered; (void)HandlerRegistered;