]> granicus.if.org Git - clang/commitdiff
Add a little hack to emulate a clang crash, so the diagnostics generator can be
authorChad Rosier <mcrosier@apple.com>
Fri, 20 Apr 2012 17:08:59 +0000 (17:08 +0000)
committerChad Rosier <mcrosier@apple.com>
Fri, 20 Apr 2012 17:08:59 +0000 (17:08 +0000)
tested.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155205 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp
tools/driver/driver.cpp

index 1ffa9b7b7d9c89f2a9bdfe633f46f4813ffce8e4..0d105ac0d0c647018b5742172db14d2395ae95a5 100644 (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)
index 8c05fff4dee93bbc56e1039c34660becba2e038a..a07738458ad18f0a04e782468519d55ee52671b0 100644 (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)