Skip to content

Conversation

statham-arm
Copy link
Collaborator

If clang/test/Driver/cl-offload.cu is run on Unix in a directory whose absolute pathname starts with /w, such as the /workspace used by at least some Jenkins CI setups, then the file name on the clang command line is misinterpreted as some kind of MSVC warning-control option, and ignored by the catch-all _SLASH_w option in Options.td.

Other clang-cl tests take care to put a -- before the input file name, to force clang to treat it as a filename even if it starts with a / and accidentally looks like a cl option. Do the same here.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Oct 24, 2023
@llvmbot
Copy link
Member

llvmbot commented Oct 24, 2023

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: Simon Tatham (statham-arm)

Changes

If clang/test/Driver/cl-offload.cu is run on Unix in a directory whose absolute pathname starts with /w, such as the /workspace used by at least some Jenkins CI setups, then the file name on the clang command line is misinterpreted as some kind of MSVC warning-control option, and ignored by the catch-all _SLASH_w option in Options.td.

Other clang-cl tests take care to put a -- before the input file name, to force clang to treat it as a filename even if it starts with a / and accidentally looks like a cl option. Do the same here.


Full diff: https://github.com/llvm/llvm-project/pull/70055.diff

1 Files Affected:

  • (modified) clang/test/Driver/cl-offload.cu (+2-2)
diff --git a/clang/test/Driver/cl-offload.cu b/clang/test/Driver/cl-offload.cu
index 650c13da15b5b58..eaa4b58afa8878b 100644
--- a/clang/test/Driver/cl-offload.cu
+++ b/clang/test/Driver/cl-offload.cu
@@ -5,11 +5,11 @@
 
 // RUN: %clang_cl -### -target x86_64-pc-windows-msvc --offload-arch=sm_35 -fgpu-rdc \
 // RUN:   --cuda-path=%S/Inputs/CUDA/usr/local/cuda \
-// RUN:   /Wall -x cuda %s 2>&1 \
+// RUN:   /Wall -x cuda -- %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=CUDA
 
 // RUN: %clang_cl -### -target x86_64-pc-windows-msvc --offload-arch=gfx1010 -fgpu-rdc --hip-link \
-// RUN:   --rocm-path=%S/Inputs/rocm /Wall -x hip %s 2>&1 \
+// RUN:   --rocm-path=%S/Inputs/rocm /Wall -x hip -- %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=HIP
 
 // CUDA: "-cc1" "-triple" "nvptx64-nvidia-cuda" "-aux-triple" "x86_64-pc-windows-msvc"

@yxsamliu
Copy link
Collaborator

can you remove // REQUIRES: !system-darwin ? Thanks.

If clang/test/Driver/cl-offload.cu is run on Unix in a directory whose
absolute pathname starts with `/w`, such as the `/workspace` used by
at least some Jenkins CI setups, then the file name on the clang
command line is misinterpreted as some kind of MSVC warning-control
option, and ignored by the catch-all `_SLASH_w` option in Options.td.

Other clang-cl tests take care to put a `--` before the input file
name, to force clang to treat it as a filename even if it starts with
a / and accidentally looks like a cl option. Do the same here.

This also allows the exclusion for `system-darwin` to be removed,
because that was trying to avoid a similar filename/option clash
involving `/Users`.
Copy link
Collaborator

@yxsamliu yxsamliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@statham-arm statham-arm merged commit 9ae11a5 into llvm:main Oct 25, 2023
@statham-arm statham-arm deleted the clang-cl-dashdash branch October 25, 2023 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants