r246881 - Fix crash on invalid if we can't find a suitable PCH file in a specified
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 4 14:44:33 PDT 2015
Author: rsmith
Date: Fri Sep 4 16:44:32 2015
New Revision: 246881
URL: http://llvm.org/viewvc/llvm-project?rev=246881&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Frontend/FrontendAction.cpp
cfe/trunk/test/PCH/pch-dir.c
Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=246881&r1=246880&r2=246881&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Fri Sep 4 16:44:32 2015
@@ -284,7 +284,7 @@ bool FrontendAction::BeginSourceFile(Com
if (!Found) {
CI.getDiagnostics().Report(diag::err_fe_no_pch_in_dir) << PCHInclude;
- return true;
+ goto failure;
}
}
}
Modified: cfe/trunk/test/PCH/pch-dir.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/pch-dir.c?rev=246881&r1=246880&r2=246881&view=diff
==============================================================================
--- cfe/trunk/test/PCH/pch-dir.c (original)
+++ cfe/trunk/test/PCH/pch-dir.c Fri Sep 4 16:44:32 2015
@@ -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
More information about the cfe-commits
mailing list