From: Rafael Espindola Date: Sun, 28 Jul 2013 13:23:37 +0000 (+0000) Subject: Avoid crashing if a directory has no pch files. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0046ce5aa0a0cae048ec8f277bc7098870294dd3;p=clang Avoid crashing if a directory has no pch files. 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 --- diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 60e615674f..075fe93d58 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -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. diff --git a/test/PCH/badpch.c b/test/PCH/badpch.c index 35e9c6ec85..c302329aaa 100644 --- a/test/PCH/badpch.c +++ b/test/PCH/badpch.c @@ -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.