2 // RUN: mkdir -p %t/Underlying
3 // RUN: mkdir -p %t/Overlay
4 // RUN: mkdir -p %t/Middle
5 // RUN: echo '// B.h in Underlying' > %t/Underlying/B.h
6 // RUN: echo '#ifdef NESTED' >> %t/Underlying/B.h
7 // RUN: echo '#include "C.h"' >> %t/Underlying/B.h
8 // RUN: echo '#endif' >> %t/Underlying/B.h
9 // RUN: echo '// C.h in Underlying' > %t/Underlying/C.h
10 // RUN: echo '// C.h in Middle' > %t/Middle/C.h
11 // RUN: echo '// C.h in Overlay' > %t/Overlay/C.h
13 // 1) Underlying -> Overlay (C.h found, B.h falling back to Underlying)
14 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}/Overlay@g" -e "s@OUT_DIR@%{/t:regex_replacement}/Underlying@g" %S/Inputs/vfsoverlay-directory.yaml > %t/vfs.yaml
15 // RUN: %clang_cc1 -Werror -I %t/Underlying -ivfsoverlay %t/vfs.yaml -E -C %s 2>&1 | FileCheck --check-prefix=DIRECT %s
16 // RUN: %clang_cc1 -Werror -I %t/Underlying -ivfsoverlay %t/vfs.yaml -DNESTED -E -C %s 2>&1 | FileCheck --check-prefix=DIRECT %s
17 // RUN: sed -e "s@INPUT_DIR@Overlay@g" -e "s@OUT_DIR@%{/t:regex_replacement}/Underlying@g" %S/Inputs/vfsoverlay-directory-relative.yaml > %t/vfs-relative.yaml
18 // RUN: %clang_cc1 -Werror -I %t/Underlying -ivfsoverlay %t/vfs-relative.yaml -E -C %s 2>&1 | FileCheck --check-prefix=DIRECT %s
20 // DIRECT: {{^}}// B.h in Underlying
21 // DIRECT: {{^}}// C.h in Overlay
23 // 2) Underlying -> Middle -> Overlay (C.h found, B.h falling back to Underlying)
24 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}/Overlay@g" -e "s@OUT_DIR@%{/t:regex_replacement}/Middle@g" %S/Inputs/vfsoverlay-directory.yaml > %t/vfs.yaml
25 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}/Middle@g" -e "s@OUT_DIR@%{/t:regex_replacement}/Underlying@g" %S/Inputs/vfsoverlay-directory.yaml > %t/vfs2.yaml
26 // RUN: %clang_cc1 -Werror -I %t/Underlying -ivfsoverlay %t/vfs.yaml -ivfsoverlay %t/vfs2.yaml -E -C %s 2>&1 | FileCheck --check-prefix=DIRECT %s
27 // RUN: %clang_cc1 -Werror -I %t/Underlying -ivfsoverlay %t/vfs.yaml -ivfsoverlay %t/vfs2.yaml -DNESTED -E -C %s 2>&1 | FileCheck --check-prefix=DIRECT %s
29 // Same as direct above
31 // 3) Underlying -> Middle -> Overlay (C.h falling back to Middle, B.h falling back to Underlying)
32 // RUN: rm -f %t/Overlay/C.h
33 // RUN: %clang_cc1 -Werror -I %t/Underlying -ivfsoverlay %t/vfs.yaml -ivfsoverlay %t/vfs2.yaml -E -C %s 2>&1 | FileCheck --check-prefix=FALLBACK %s
35 // FALLBACK: {{^}}// B.h in Underlying
36 // FALLBACK: {{^}}// C.h in Middle
38 // 3) Underlying -> Middle -> Overlay (C.h falling back to Underlying, B.h falling back to Underlying)
39 // RUN: rm -f %t/Middle/C.h
40 // RUN: %clang_cc1 -Werror -I %t/Underlying -ivfsoverlay %t/vfs.yaml -ivfsoverlay %t/vfs2.yaml -E -C %s 2>&1 | FileCheck --check-prefix=FALLBACK2 %s
42 // FALLBACK2: {{^}}// B.h in Underlying
43 // FALLBACK2: {{^}}// C.h in Underlying