Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Driver / wasm-toolchain.cpp
blob4af011097021f64a502d853406f7945ba5b00053
1 // A basic clang -cc1 command-line. WebAssembly is somewhat special in
2 // enabling -fvisibility=hidden by default.
4 // RUN: %clangxx -### %s --target=wasm32-unknown-unknown 2>&1 \
5 // RUN: | FileCheck -check-prefix=CC1 %s
6 // CC1: "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility=hidden" {{.*}}
8 // Ditto, but ensure that a user -fvisibility=default disables the default
9 // -fvisibility=hidden.
11 // RUN: %clangxx -### %s --target=wasm32-unknown-unknown -fvisibility=default 2>&1 \
12 // RUN: | FileCheck -check-prefix=FVISIBILITY_DEFAULT %s
13 // FVISIBILITY_DEFAULT-NOT: hidden
15 // A basic C++ link command-line with unknown OS.
17 // RUN: %clangxx -### --target=wasm32-unknown-unknown --sysroot=/foo --stdlib=libc++ %s 2>&1 \
18 // RUN: | FileCheck -check-prefix=LINK %s
19 // LINK: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
20 // LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
22 // RUN: %clangxx -### --target=wasm32-unknown-unknown --sysroot=/foo --stdlib=libstdc++ %s 2>&1 \
23 // RUN: | FileCheck -check-prefix=LINK_STDCXX %s
24 // LINK_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
25 // LINK_STDCXX: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
27 // A basic C++ link command-line with optimization with unknown OS.
29 // RUN: %clangxx -### -O2 --target=wasm32-unknown-unknown --sysroot=/foo %s --stdlib=libc++ 2>&1 \
30 // RUN: | FileCheck -check-prefix=LINK_OPT %s
31 // LINK_OPT: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
32 // LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
34 // RUN: %clangxx -### -O2 --target=wasm32-unknown-unknown --sysroot=/foo %s --stdlib=libstdc++ 2>&1 \
35 // RUN: | FileCheck -check-prefix=LINK_OPT_STDCXX %s
36 // LINK_OPT_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
37 // LINK_OPT_STDCXX: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
39 // A basic C++ link command-line with known OS.
41 // RUN: %clangxx -### --target=wasm32-wasi --sysroot=/foo --stdlib=libc++ %s 2>&1 \
42 // RUN: | FileCheck -check-prefix=LINK_KNOWN %s
43 // LINK_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
44 // LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
46 // RUN: %clangxx -### --target=wasm32-wasi --sysroot=/foo --stdlib=libstdc++ %s 2>&1 \
47 // RUN: | FileCheck -check-prefix=LINK_KNOWN_STDCXX %s
48 // LINK_KNOWN_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
49 // LINK_KNOWN_STDCXX: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
51 // A basic C++ link command-line with optimization with known OS.
53 // RUN: %clangxx -### -O2 --target=wasm32-wasi --sysroot=/foo %s --stdlib=libc++ 2>&1 \
54 // RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN %s
55 // LINK_OPT_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
56 // LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
58 // RUN: %clangxx -### -O2 --target=wasm32-wasi --sysroot=/foo %s --stdlib=libstdc++ 2>&1 \
59 // RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN_STDCXX %s
60 // LINK_OPT_KNOWN_STDCXX: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
61 // LINK_OPT_KNOWN_STDCXX: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lstdc++" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
63 // A basic C++ compile command-line with known OS.
65 // RUN: %clangxx -### --target=wasm32-wasi --stdlib=libc++ %s 2>&1 \
66 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree/usr \
67 // RUN: | FileCheck -check-prefix=COMPILE %s
68 // COMPILE: "-cc1"
69 // COMPILE: "-resource-dir" "[[RESOURCE_DIR:[^"]*]]"
70 // COMPILE: "-isysroot" "[[SYSROOT:[^"]+]]"
71 // COMPILE: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/wasm32-wasi/c++/v1"
72 // COMPILE: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/v1"
73 // COMPILE: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
74 // COMPILE: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/wasm32-wasi"
75 // COMPILE: "-internal-isystem" "[[SYSROOT:[^"]+]]/include"
77 // RUN: %clangxx -### --target=wasm32-wasi --stdlib=libstdc++ %s 2>&1 \
78 // RUN: --sysroot=%S/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr \
79 // RUN: | FileCheck -check-prefix=COMPILE_STDCXX %s
80 // COMPILE_STDCXX: "-cc1"
81 // COMPILE_STDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]*]]"
82 // COMPILE_STDCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
83 // COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/4.8/wasm32-wasi"
84 // COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/4.8"
85 // COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/4.8/backward"
86 // COMPILE_STDCXX: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
87 // COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/wasm32-wasi"
88 // COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include"