]> granicus.if.org Git - clang/commitdiff
Avoid crashing if a directory has no pch files.
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 28 Jul 2013 13:23:37 +0000 (13:23 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 28 Jul 2013 13:23:37 +0000 (13:23 +0000)
Should fix some of the bots that have assertions disabled.

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

lib/Frontend/FrontendAction.cpp
test/PCH/badpch.c

index 60e615674fa0fed6d7ff3605a736971b49f828fd..075fe93d58416dc4ff6325d9582a330fd210f928 100644 (file)
@@ -455,6 +455,8 @@ bool FrontendAction::shouldEraseOutputFiles() {
 
 void ASTFrontendAction::ExecuteAction() {
   CompilerInstance &CI = getCompilerInstance();
+  if (!CI.hasPreprocessor())
+    return;
 
   // FIXME: Move the truncation aspect of this into Sema, we delayed this till
   // here so the source manager would be initialized.
index 35e9c6ec852b0f3f2f8f0d1c82c12e9c3f5d4f66..c302329aaae82aa735d2e8419f21c823e314e8d5 100644 (file)
@@ -1,5 +1,5 @@
 // RUN: not %clang_cc1 -fsyntax-only -include-pch %S/Inputs/badpch-empty.h.gch %s 2>&1 | FileCheck -check-prefix=CHECK-EMPTY %s
-// RUN: not --crash %clang_cc1 -fsyntax-only -include-pch %S/Inputs/badpch-dir.h.gch %s 2>&1 | FileCheck -check-prefix=CHECK-DIR %s
+// RUN: not %clang_cc1 -fsyntax-only -include-pch %S/Inputs/badpch-dir.h.gch %s 2>&1 | FileCheck -check-prefix=CHECK-DIR %s
 
 // The purpose of this test is to verify that various invalid PCH files are
 // reported as such.