1 // Verify that we don't pass unwanted options to device-side compilation when
2 // clang-cl is used for CUDA compilation.
3 // Note: %s must be preceded by --, otherwise it may be interpreted as a
4 // command-line option, e.g. on Mac where %s is commonly under /Users.
5 
6 // REQUIRES: clang-driver
7 // REQUIRES: x86-registered-target
8 // REQUIRES: nvptx-registered-target
9 
10 // -stack-protector should not be passed to device-side CUDA compilation
11 // RUN: %clang_cl -### -nocudalib -nocudainc -- %s 2>&1 | FileCheck -check-prefix=GS-default %s
12 // GS-default: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
13 // GS-default-NOT: "-stack-protector"
14 // GS-default: "-cc1" "-triple"
15 // GS-default: "-stack-protector" "2"
16 
17 // -exceptions should be passed to device-side compilation.
18 // RUN: %clang_cl /c /GX -### -nocudalib -nocudainc -- %s 2>&1 | FileCheck -check-prefix=GX %s
19 // GX: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
20 // GX-NOT: "-fcxx-exceptions"
21 // GX-NOT: "-fexceptions"
22 // GX: "-cc1" "-triple"
23 // GX: "-fcxx-exceptions" "-fexceptions"
24 
25 // /Gd should not override default calling convention on device side.
26 // RUN: %clang_cl /c /Gd -### -nocudalib -nocudainc -- %s 2>&1 | FileCheck -check-prefix=Gd %s
27 // Gd: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
28 // Gd-NOT: "-fcxx-exceptions"
29 // Gd-NOT: "-fdefault-calling-conv=cdecl"
30 // Gd: "-cc1" "-triple"
31 // Gd: "-fdefault-calling-conv=cdecl"
32