[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / VFS / fallback.c
blob11392bdc4e449858bc813306f45a80aa027123f5
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
4 // Test fallback directory remapping, ie. a directory "Base" which is used as
5 // a fallback if files are missing from "UseFirst"
7 // RUN: sed -e "s@EXTERNAL_DIR@%{/t:regex_replacement}/Both/Base@g" -e "s@NAME_DIR@%{/t:regex_replacement}/Both/UseFirst@g" %t/vfs/base.yaml > %t/vfs/both.yaml
9 // RUN: cp -R %t/Both %t/UseFirstOnly
10 // RUN: rm -rf %t/UseFirstOnly/Base
11 // RUN: sed -e "s@EXTERNAL_DIR@%{/t:regex_replacement}/UseFirstOnly/Base@g" -e "s@NAME_DIR@%{/t:regex_replacement}/UseFirstOnly/UseFirst@g" %t/vfs/base.yaml > %t/vfs/use-first-only.yaml
13 // RUN: cp -R %t/Both %t/BaseOnly
14 // RUN: rm -rf %t/BaseOnly/UseFirst
15 // RUN: sed -e "s@EXTERNAL_DIR@%{/t:regex_replacement}/BaseOnly/Base@g" -e "s@NAME_DIR@%{/t:regex_replacement}/BaseOnly/UseFirst@g" %t/vfs/base.yaml > %t/vfs/base-only.yaml
17 // RUN: cp -R %t/Both %t/BFallback
18 // RUN: rm %t/BFallback/UseFirst/B.h
19 // RUN: sed -e "s@EXTERNAL_DIR@%{/t:regex_replacement}/BFallback/Base@g" -e "s@NAME_DIR@%{/t:regex_replacement}/BFallback/UseFirst@g" %t/vfs/base.yaml > %t/vfs/b-fallback.yaml
21 // RUN: cp -R %t/Both %t/CFallback
22 // RUN: rm %t/CFallback/UseFirst/C.h
23 // RUN: sed -e "s@EXTERNAL_DIR@%{/t:regex_replacement}/CFallback/Base@g" -e "s@NAME_DIR@%{/t:regex_replacement}/CFallback/UseFirst@g" %t/vfs/base.yaml > %t/vfs/c-fallback.yaml
25 // Both B.h and C.h are in both folders
26 // RUN: %clang_cc1 -Werror -I %t/Both/UseFirst -ivfsoverlay %t/vfs/both.yaml -fsyntax-only -E -C %t/main.c 2>&1 | FileCheck --check-prefix=IN_UF %s
28 // IN_UF: # 1 "{{.*(/|\\\\)UseFirst(/|\\\\)}}B.h"
29 // IN_UF-NEXT: // B.h in UseFirst
30 // IN_UF: # 1 "{{.*(/|\\\\)UseFirst(/|\\\\)}}C.h"
31 // IN_UF-NEXT: // C.h in UseFirst
33 // Base missing, so now they are only in UseFirst
34 // RUN: %clang_cc1 -Werror -I %t/UseFirstOnly/UseFirst -ivfsoverlay %t/vfs/use-first-only.yaml -fsyntax-only -E -C %t/main.c 2>&1 | FileCheck --check-prefix=IN_UF %s
36 // UseFirst missing, fallback to Base
37 // RUN: %clang_cc1 -Werror -I %t/BaseOnly/UseFirst -ivfsoverlay %t/vfs/base-only.yaml -fsyntax-only -E -C %t/main.c 2>&1 | FileCheck --check-prefix=IN_BASE %s
39 // IN_BASE: # 1 "{{.*(/|\\\\)Base(/|\\\\)}}B.h"
40 // IN_BASE-NEXT: // B.h in Base
41 // IN_BASE: # 1 "{{.*(/|\\\\)Base(/|\\\\)}}C.h"
42 // IN_BASE-NEXT: // C.h in Base
44 // B.h missing from UseFirst
45 // RUN: %clang_cc1 -Werror -I %t/BFallback/UseFirst -ivfsoverlay %t/vfs/b-fallback.yaml -fsyntax-only -E -C %t/main.c 2>&1 | FileCheck --check-prefix=B_FALLBACK %s
47 // B_FALLBACK: # 1 "{{.*(/|\\\\)Base(/|\\\\)}}B.h"
48 // B_FALLBACK-NEXT: // B.h in Base
49 // B_FALLBACK: # 1 "{{.*(/|\\\\)UseFirst(/|\\\\)}}C.h"
50 // B_FALLBACK-NEXT: // C.h in UseFirst
52 // C.h missing from UseFirst
53 // RUN: %clang_cc1 -Werror -I %t/CFallback/UseFirst -ivfsoverlay %t/vfs/c-fallback.yaml -fsyntax-only -E -C %t/main.c 2>&1 | FileCheck --check-prefix=C_FALLBACK %s
55 // C_FALLBACK: # 1 "{{.*(/|\\\\)UseFirst(/|\\\\)}}B.h"
56 // C_FALLBACK-NEXT: // B.h in UseFirst
57 // C_FALLBACK: # 1 "{{.*(/|\\\\)Base(/|\\\\)}}C.h"
58 // C_FALLBACK-NEXT: // C.h in Base
60 //--- main.c
61 #include "B.h"
63 //--- Both/UseFirst/B.h
64 // B.h in UseFirst
65 #include "C.h"
67 //--- Both/UseFirst/C.h
68 // C.h in UseFirst
70 //--- Both/Base/B.h
71 // B.h in Base
72 #include "C.h"
74 //--- Both/Base/C.h
75 // C.h in Base
77 //--- vfs/base.yaml
79 'version' : 0,
80 'redirecting-with' : 'fallback',
81 'roots' : [
82 {'name' : 'NAME_DIR',
83 'type' : 'directory-remap',
84 'external-contents' : 'EXTERNAL_DIR'}