diff options
Diffstat (limited to 'clang/lib/Lex/Pragma.cpp')
-rw-r--r-- | clang/lib/Lex/Pragma.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index eec1d1d6eea..0ef87b96d3b 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/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/ErrorHandling.h" #include <algorithm> using namespace clang; @@ -697,20 +698,25 @@ struct PragmaDebugHandler : public PragmaHandler { } IdentifierInfo *II = Tok.getIdentifierInfo(); - if (II->isStr("overflow_stack")) { - DebugOverflowStack(); + if (II->isStr("assert")) { + assert(0 && "This is an assertion!"); } else if (II->isStr("crash")) { - DebugCrash(); + *(volatile int*) 0x11 = 0; + } else if (II->isStr("llvm_fatal_error")) { + llvm::report_fatal_error("#pragma clang __debug llvm_fatal_error"); + } else if (II->isStr("llvm_unreachable")) { + llvm_unreachable("#pragma clang __debug llvm_unreachable"); + } else if (II->isStr("overflow_stack")) { + DebugOverflowStack(); + } else { + PP.Diag(Tok, diag::warn_pragma_debug_unexpected_command) + << II->getName(); } } void DebugOverflowStack() { DebugOverflowStack(); } - - void DebugCrash() { - *(volatile int*) 0x11 = 0; - } }; /// PragmaDiagnosticHandler - e.g. '#pragma GCC diagnostic ignored "-Wformat"' |