xref: /aosp_15_r20/external/clang/test/VFS/module-import.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: rm -rf %t
2*67e74705SXin Li// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml
3*67e74705SXin Li// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t.yaml -I %t -fsyntax-only %s
4*67e74705SXin Li// REQUIRES: shell
5*67e74705SXin Li
6*67e74705SXin Li@import not_real;
7*67e74705SXin Li
8*67e74705SXin Livoid foo() {
9*67e74705SXin Li  bar();
10*67e74705SXin Li}
11*67e74705SXin Li
12*67e74705SXin Li// Import a submodule that is defined in actual_module2.map, which is only
13*67e74705SXin Li// mapped in vfsoverlay2.yaml.
14*67e74705SXin Li#ifdef IMPORT2
15*67e74705SXin Li@import not_real.from_second_module;
16*67e74705SXin Li// CHECK-VFS2: error: no submodule
17*67e74705SXin Li#endif
18*67e74705SXin Li
19*67e74705SXin Li// Override the module map (vfsoverlay2 on top)
20*67e74705SXin Li// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay2.yaml > %t2.yaml
21*67e74705SXin Li// RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -I %t -fsyntax-only %s
22*67e74705SXin Li
23*67e74705SXin Li// vfsoverlay2 not present
24*67e74705SXin Li// RUN: not %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -DIMPORT2 2>&1 | FileCheck -check-prefix=CHECK-VFS2 %s
25*67e74705SXin Li
26*67e74705SXin Li// vfsoverlay2 on the bottom
27*67e74705SXin Li// RUN: not %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t2.yaml -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -DIMPORT2 2>&1 | FileCheck -check-prefix=CHECK-VFS2 %s
28