aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-08-18 23:09:23 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-08-18 23:09:23 +0000
commitff759a66526d6a985fb4efae69c6b798d83364df (patch)
tree7b23a558d3b90b2ae0f0c6cdf302f35ada37fe25
parentc8a618002ca57495bf70e055bcafe918859cf4ca (diff)
CrashRecovery: Add #pragma clang __debug handle_crash, useful when debugging
CrashRecovery since it avoids sending a signal which may be intercepted by the debugger. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111449 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Lex/Pragma.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp
index 0ef87b96d3..f0f3bce008 100644
--- a/lib/Lex/Pragma.cpp
+++ b/lib/Lex/Pragma.cpp
@@ -20,6 +20,7 @@
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
+#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
using namespace clang;
@@ -708,6 +709,10 @@ struct PragmaDebugHandler : public PragmaHandler {
llvm_unreachable("#pragma clang __debug llvm_unreachable");
} else if (II->isStr("overflow_stack")) {
DebugOverflowStack();
+ } else if (II->isStr("handle_crash")) {
+ llvm::CrashRecoveryContext *CRC =llvm::CrashRecoveryContext::GetCurrent();
+ if (CRC)
+ CRC->HandleCrash();
} else {
PP.Diag(Tok, diag::warn_pragma_debug_unexpected_command)
<< II->getName();