Add a little hack to emulate a clang crash, so the diagnostics generator can be

tested.

llvm-svn: 155205
This commit is contained in:
Chad Rosier 2012-04-20 17:08:59 +00:00
parent 440b524b46
commit 681e4b8d96
2 changed files with 5 additions and 1 deletions

View File

@ -379,7 +379,7 @@ void Driver::generateCompilationDiagnostics(Compilation &C,
return;
// Don't try to generate diagnostics for link jobs.
if (FailingCommand->getCreator().isLinkJob())
if (FailingCommand && FailingCommand->getCreator().isLinkJob())
return;
Diag(clang::diag::note_drv_command_failed_diag_msg)

View File

@ -475,6 +475,10 @@ int main(int argc_, const char **argv_) {
if (C.get())
Res = TheDriver.ExecuteCompilation(*C, FailingCommand);
// Force a crash to test the diagnostics.
if(::getenv("FORCE_CLANG_DIAGNOSTICS_CRASH"))
Res = -1;
// If result status is < 0, then the driver command signalled an error.
// In this case, generate additional diagnostic information if possible.
if (Res < 0)