xref: /aosp_15_r20/external/clang/test/Modules/fatal-module-loader-error.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: rm -rf %t
2*67e74705SXin Li// RUN: mkdir %t
3*67e74705SXin Li// RUN: touch %t/Module.pcm
4*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -fdisable-module-hash -F %S/Inputs -verify
5*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -fdisable-module-hash -F %S/Inputs -DIMPLICIT -verify
6*67e74705SXin Li
7*67e74705SXin Li// This tests that after a fatal module loader error, we do not continue parsing.
8*67e74705SXin Li
9*67e74705SXin Li#ifdef IMPLICIT
10*67e74705SXin Li
11*67e74705SXin Li// expected-error@+1{{Module.pcm' is not a valid precompiled module file}}
12*67e74705SXin Li#import <Module/Module.h>
13*67e74705SXin Li#pragma clang __debug crash;
14*67e74705SXin Li
15*67e74705SXin Li#else
16*67e74705SXin Li
17*67e74705SXin Li// expected-error@+1{{Module.pcm' is not a valid precompiled module file}}
18*67e74705SXin Li@import Module;
19*67e74705SXin Li#pragma clang __debug crash;
20*67e74705SXin Li
21*67e74705SXin Li#endif
22*67e74705SXin Li
23*67e74705SXin Li// Also check that libclang does not create a PCH with such an error.
24*67e74705SXin Li// RUN: not c-index-test -write-pch %t.pch -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
25*67e74705SXin Li// RUN: %s -Xclang -fdisable-module-hash -F %S/Inputs 2>&1 | FileCheck %s
26*67e74705SXin Li// CHECK: {{^}}Failure: AST deserialization error occurred{{$}}
27