[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Driver / compiler-rt-unwind.c
blobc5040d7fd900bac080a73a31bf329081390f0bb8
1 // General tests that the driver handles combinations of --rtlib=XXX and
2 // --unwindlib=XXX properly.
3 //
4 // RUN: %clang -### %s 2>&1 \
5 // RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=platform \
6 // RUN: -resource-dir=%S/Inputs/resource_dir \
7 // RUN: | FileCheck --check-prefix=RTLIB-GCC %s
8 // RTLIB-GCC: "-lgcc"
9 // RTLIB-GCC-SAME: "--as-needed"
10 // RTLIB-GCC-SAME: "-lgcc_s"
11 // RTLIB-GCC-SAME: "--no-as-needed"
13 // RUN: %clangxx -### %s 2>&1 \
14 // RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=platform \
15 // RUN: -resource-dir=%S/Inputs/resource_dir \
16 // RUN: | FileCheck --check-prefix=RTLIB-GXX %s
17 // RTLIB-GXX: "-lgcc"
18 // RTLIB-GXX-NOT: "--as-needed"
19 // RTLIB-GXX-SAME: "-lgcc_s"
20 // RTLIB-GXX-NOT: "--no-as-needed"
22 // RUN: not %clang -### %s 2>&1 \
23 // RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
24 // RUN: -resource-dir=%S/Inputs/resource_dir \
25 // RUN: | FileCheck --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER-RT %s
26 // RUN: not %clangxx -### %s 2>&1 \
27 // RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
28 // RUN: -resource-dir=%S/Inputs/resource_dir \
29 // RUN: | FileCheck --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER-RT %s
30 // RTLIB-GCC-UNWINDLIB-COMPILER-RT: "-lgcc"
31 // RTLIB-GCC-UNWINDLIB-COMPILER-RT-SAME: "--as-needed"
32 // RTLIB-GCC-UNWINDLIB-COMPILER-RT-SAME: "-lunwind"
33 // RTLIB-GCC-UNWINDLIB-COMPILER-RT-SAME: "--no-as-needed"
35 // RUN: not %clang -### %s 2>&1 \
36 // RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
37 // RUN: -shared-libgcc \
38 // RUN: -resource-dir=%S/Inputs/resource_dir \
39 // RUN: | FileCheck --check-prefix=RTLIB-GCC-SHARED-UNWINDLIB-COMPILER-RT %s
40 // RTLIB-GCC-SHARED-UNWINDLIB-COMPILER-RT: "-l:libunwind.so"
41 // RTLIB-GCC-SHARED-UNWINDLIB-COMPILER-RT-SAME: "-lgcc"
43 // RUN: not %clang -### %s 2>&1 \
44 // RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
45 // RUN: -static-libgcc \
46 // RUN: -resource-dir=%S/Inputs/resource_dir \
47 // RUN: | FileCheck --check-prefix=RTLIB-GCC-STATIC-UNWINDLIB-COMPILER-RT %s
48 // RTLIB-GCC-STATIC-UNWINDLIB-COMPILER-RT: "-lgcc"
49 // RTLIB-GCC-STATIC-UNWINDLIB-COMPILER-RT-SAME: "-l:libunwind.a"
51 // RUN: %clang -### %s 2>&1 \
52 // RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt \
53 // RUN: -resource-dir=%S/Inputs/resource_dir \
54 // RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT %s
55 // RTLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
57 // RUN: %clang -### %s 2>&1 \
58 // RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libunwind \
59 // RUN: -resource-dir=%S/Inputs/resource_dir \
60 // RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
61 // RUN: %clangxx -### %s 2>&1 \
62 // RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libunwind \
63 // RUN: -resource-dir=%S/Inputs/resource_dir \
64 // RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
65 // RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
66 // RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "--as-needed"
67 // RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "-lunwind"
68 // RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "--no-as-needed"
70 // RUN: %clang -### %s 2>&1 \
71 // RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
72 // RUN: -resource-dir=%S/Inputs/resource_dir \
73 // RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC %s
74 // RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}libclang_rt.builtins.a"
75 // RTLIB-COMPILER-RT-UNWINDLIB-GCC-SAME: "-lgcc_s"
77 // RUN: %clang -### %s 2>&1 \
78 // RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
79 // RUN: -static -resource-dir=%S/Inputs/resource_dir \
80 // RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC %s
81 // RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}libclang_rt.builtins.a"
82 // RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC-SAME: "-lgcc_eh"
84 // RUN: not %clang %s 2> %t.err \
85 // RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
86 // RUN: -resource-dir=%S/Inputs/resource_dir \
87 // RUN: FileCheck --input-file=%t.err --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER_RT %s
88 // RTLIB-GCC-UNWINDLIB-COMPILER_RT: "{{[.|\\\n]*}}--rtlib=libgcc requires --unwindlib=libgcc"
90 // RUN: %clang -### %s 2>&1 \
91 // RUN: --target=x86_64-pc-windows-msvc -rtlib=compiler-rt --unwindlib=libunwind \
92 // RUN: -resource-dir=%S/Inputs/resource_dir \
93 // RUN: | FileCheck --check-prefix=MSVC-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
94 // MSVC-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}clang_rt.builtins-x86_64.lib"
95 // MSVC-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-NOT: "{{.*}}unwind.lib"
97 // RUN: %clang -### %s 2>&1 \
98 // RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
99 // RUN: -shared-libgcc \
100 // RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT %s
101 // MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
102 // MINGW-RTLIB-COMPILER-RT-SHARED-UNWINDLIB-COMPILER-RT-SAME: "-l:libunwind.dll.a"
104 // RUN: %clang -### %s 2>&1 \
105 // RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
106 // RUN: -static-libgcc \
107 // RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT %s
108 // MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
109 // MINGW-RTLIB-COMPILER-RT-STATIC-UNWINDLIB-COMPILER-RT-SAME: "-l:libunwind.a"
111 // RUN: %clang -### %s 2>&1 \
112 // RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
113 // RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
114 // RUN: %clangxx -### %s 2>&1 \
115 // RUN: --target=x86_64-w64-mingw32 -rtlib=compiler-rt --unwindlib=libunwind \
116 // RUN: | FileCheck --check-prefix=MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT %s
117 // MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins.a"
118 // MINGW-RTLIB-COMPILER-RT-UNWINDLIB-COMPILER-RT-SAME: "-lunwind"