File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -826,10 +826,15 @@ bool ClangImporter::canReadPCH(StringRef PCHFilename) {
826
826
};
827
827
ctx.InitBuiltinTypes (CI.getTarget ());
828
828
829
+ auto failureCapabilities =
830
+ clang::ASTReader::ARR_Missing |
831
+ clang::ASTReader::ARR_OutOfDate |
832
+ clang::ASTReader::ARR_VersionMismatch;
833
+
829
834
auto result = Reader->ReadAST (PCHFilename,
830
835
clang::serialization::MK_PCH,
831
836
clang::SourceLocation (),
832
- clang::ASTReader::ARR_None );
837
+ failureCapabilities );
833
838
switch (result) {
834
839
case clang::ASTReader::Success:
835
840
return true ;
Original file line number Diff line number Diff line change
1
+ // Dummy file to test PCH loading errors
2
+
3
+ int c_func (int x ) {
4
+ return x + 27 ;
5
+ }
Original file line number Diff line number Diff line change
1
+ // Check that there are no errors printed when trying to load an outdated PCH file
2
+ // rdar://problem/53312911
3
+
4
+ // RUN: %empty-directory(%t)
5
+ // RUN: cp %S/Inputs/pch-loading-error.h %t/pch-loading-error.h
6
+ // RUN: %target-swift-frontend -parse-as-library -module-name=pch_loading_error -emit-sil %s -enable-objc-interop -import-objc-header %t/pch-loading-error.h -pch-output-dir %t/pch
7
+ // RUN: %S/../ParseableInterface/ModuleCache/Inputs/make-old.py %t/pch/*
8
+ // RUN: echo "// force newer header than pch" >> %t/pch-loading-error.h
9
+ // RUN: %target-swift-frontend -parse-as-library -module-name=pch_loading_error -emit-sil %s -enable-objc-interop -import-objc-header %t/pch-loading-error.h -pch-output-dir %t/pch 2>&1 | %FileCheck %s
10
+ // RUN: %S/../ParseableInterface/ModuleCache/Inputs/check-is-new.py %t/pch/*
11
+
12
+ // CHECK-NOT: fatal error
13
+
14
+ public func mytest( x: Int32 ) -> Int32 {
15
+ return c_func ( x)
16
+ }
You can’t perform that action at this time.
0 commit comments