1 // A basic clang -cc1 command-line. WebAssembly is somewhat special in
2 // enabling -fvisibility=hidden by default.
3 
4 // RUN: %clangxx %s -### -no-canonical-prefixes -target wasm32-unknown-unknown 2>&1 \
5 // RUN:   | FileCheck -check-prefix=CC1 %s
6 // CC1: clang{{.*}} "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility" "hidden" {{.*}}
7 
8 // Ditto, but ensure that a user -fvisibility=default disables the default
9 // -fvisibility=hidden.
10 
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
14 
15 // A basic C++ link command-line with unknown OS.
16 
17 // RUN: %clangxx -### -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo --stdlib=c++ %s 2>&1 \
18 // RUN:   | FileCheck -check-prefix=LINK %s
19 // LINK: clang{{.*}}" "-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"
21 
22 // A basic C++ link command-line with optimization with unknown OS.
23 
24 // RUN: %clangxx -### -O2 -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s --stdlib=c++ 2>&1 \
25 // RUN:   | FileCheck -check-prefix=LINK_OPT %s
26 // LINK_OPT: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
27 // LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
28 
29 // A basic C++ link command-line with known OS.
30 
31 // RUN: %clangxx -### -no-canonical-prefixes -target wasm32-wasi --sysroot=/foo --stdlib=c++ %s 2>&1 \
32 // RUN:   | FileCheck -check-prefix=LINK_KNOWN %s
33 // LINK_KNOWN: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
34 // LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
35 
36 // A basic C++ link command-line with optimization with known OS.
37 
38 // RUN: %clangxx -### -O2 -no-canonical-prefixes -target wasm32-wasi --sysroot=/foo %s --stdlib=c++ 2>&1 \
39 // RUN:   | FileCheck -check-prefix=LINK_OPT_KNOWN %s
40 // LINK_OPT_KNOWN: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
41 // 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"
42 
43 // A basic C++ compile command-line with known OS.
44 
45 // RUN: %clangxx -### -no-canonical-prefixes -target wasm32-wasi --sysroot=/foo --stdlib=c++ %s 2>&1 \
46 // RUN:   | FileCheck -check-prefix=COMPILE %s
47 // COMPILE: clang{{.*}}" "-cc1"
48 // COMPILE: "-resource-dir" "[[RESOURCE_DIR:[^"]*]]"
49 // COMPILE: "-isysroot" "/foo"
50 // COMPILE: "-internal-isystem" "/foo/include/wasm32-wasi/c++/v1"
51 // COMPILE: "-internal-isystem" "/foo/include/c++/v1"
52 // COMPILE: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include"
53 // COMPILE: "-internal-isystem" "/foo/include/wasm32-wasi"
54 // COMPILE: "-internal-isystem" "/foo/include"
55