From: Daniel Dunbar Date: Wed, 18 Aug 2010 23:09:23 +0000 (+0000) Subject: CrashRecovery: Add #pragma clang __debug handle_crash, useful when debugging X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff759a66526d6a985fb4efae69c6b798d83364df;p=clang 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 --- 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 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();