xref: /llvm-project/clang/test/VFS/external-names-multi-overlay.c (revision 7c1d9b15eee3a34678addab2bab66f3020ac0753)
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: sed -e "s@NAME_DIR@%{/t:regex_replacement}/A@g" -e "s@EXTERNAL_DIR@%{/t:regex_replacement}/B@g" -e "s@REDIRECT_WITH@fallthrough@g" %t/vfs/base.yaml > %t/vfs/a-b-ft.yaml
4 // RUN: sed -e "s@NAME_DIR@%{/t:regex_replacement}/A@g" -e "s@EXTERNAL_DIR@%{/t:regex_replacement}/B@g" -e "s@REDIRECT_WITH@fallback@g" %t/vfs/base.yaml > %t/vfs/a-b-fb.yaml
5 
6 // Check that the external name is given when multiple overlays are provided
7 
8 // RUN: %clang_cc1 -Werror -I %t/A -ivfsoverlay %t/vfs/a-b-ft.yaml -ivfsoverlay %t/vfs/empty.yaml -E -C %t/main.c 2>&1 | FileCheck --check-prefix=FROM_B %s
9 // RUN: %clang_cc1 -Werror -I %t/A -ivfsoverlay %t/vfs/a-b-fb.yaml -ivfsoverlay %t/vfs/empty.yaml -E -C %t/main.c 2>&1 | FileCheck --check-prefix=FROM_B %s
10 // RUN: %clang_cc1 -Werror -I %t/B -ivfsoverlay %t/vfs/a-b-ft.yaml -ivfsoverlay %t/vfs/empty.yaml -E -C %t/main.c 2>&1 | FileCheck --check-prefix=FROM_B %s
11 // RUN: %clang_cc1 -Werror -I %t/B -ivfsoverlay %t/vfs/a-b-fb.yaml -ivfsoverlay %t/vfs/empty.yaml -E -C %t/main.c 2>&1 | FileCheck --check-prefix=FROM_B %s
12 // FROM_B: # 1 "{{.*(/|\\\\)B(/|\\\\)}}Header.h"
13 // FROM_B: // Header.h in B
14 
15 //--- main.c
16 #include "Header.h"
17 
18 //--- B/Header.h
19 // Header.h in B
20 
21 //--- vfs/base.yaml
22 {
23   'version': 0,
24   'redirecting-with': 'REDIRECT_WITH',
25   'roots': [
26     { 'name': 'NAME_DIR',
27       'type': 'directory-remap',
28       'external-contents': 'EXTERNAL_DIR'
29     }
30   ]
31 }
32 
33 //--- vfs/empty.yaml
34 {
35   'version': 0,
36   'roots': []
37 }
38