CrashRecovery: Add #pragma clang __debug handle_crash, useful when debugging

CrashRecovery since it avoids sending a signal which may be intercepted by the
debugger.

llvm-svn: 111449
This commit is contained in:
Daniel Dunbar 2010-08-18 23:09:23 +00:00
parent ec29d712d4
commit 211a787eaf
1 changed files with 5 additions and 0 deletions

View File

@ -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();