diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-09-04 21:44:32 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-09-04 21:44:32 +0000 |
commit | 81c7248cac003289310ed791f3d6ce2be676a485 (patch) | |
tree | 245501db130bde8eb3050eaeea3e3c53dba3f977 | |
parent | 5ee4b9a11fb70efbbccb9e717012cb8432e9ea84 (diff) | |
download | bcm5719-llvm-81c7248cac003289310ed791f3d6ce2be676a485.tar.gz bcm5719-llvm-81c7248cac003289310ed791f3d6ce2be676a485.zip |
Fix crash on invalid if we can't find a suitable PCH file in a specified
directory, and our frontend action cares whether the frontend setup actually
succeeded.
llvm-svn: 246881
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 2 | ||||
-rw-r--r-- | clang/test/PCH/pch-dir.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 14921229042..ecef92e0a7d 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -284,7 +284,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, if (!Found) { CI.getDiagnostics().Report(diag::err_fe_no_pch_in_dir) << PCHInclude; - return true; + goto failure; } } } diff --git a/clang/test/PCH/pch-dir.c b/clang/test/PCH/pch-dir.c index 2ac10ea56c9..944753c9c9c 100644 --- a/clang/test/PCH/pch-dir.c +++ b/clang/test/PCH/pch-dir.c @@ -1,4 +1,6 @@ +// RUN: rm -rf %t.h.gch // RUN: mkdir -p %t.h.gch +// // RUN: %clang -x c-header %S/pch-dir.h -DFOO=foo -o %t.h.gch/c.gch // RUN: %clang -x c-header %S/pch-dir.h -DFOO=bar -o %t.h.gch/cbar.gch // RUN: %clang -x c++-header -std=c++98 %S/pch-dir.h -o %t.h.gch/cpp.gch @@ -10,7 +12,11 @@ // RUN: FileCheck -check-prefix=CHECK-CPP %s < %t.cpplog // RUN: not %clang -x c++ -std=c++11 -include %t.h -fsyntax-only %s 2> %t.cpp11log -// RUN: FileCheck -check-prefix=CHECK-CPP11 %s < %t.cpp11log +// RUN: FileCheck -check-prefix=CHECK-NO-SUITABLE %s < %t.cpp11log + +// Don't crash if the precompiled header file is missing. +// RUN: not %clang_cc1 -include-pch %t.h.gch -DFOO=baz -fsyntax-only %s -print-stats 2> %t.missinglog +// RUN: FileCheck -check-prefix=CHECK-NO-SUITABLE %s < %t.missinglog // CHECK-CBAR: int bar int FOO; @@ -25,4 +31,4 @@ int get() { #endif } -// CHECK-CPP11: no suitable precompiled header file found in directory +// CHECK-NO-SUITABLE: no suitable precompiled header file found in directory |