[clang] [test] Fix clang-cl unused argument tests on paths that start with /U

This reinstates a test that was temporarily removed in
e26bbae302, in a form that works on
Darwin.

Use -LD instead of -link as a linker argument that is unused when
compiling, that produces warnings normally. -LD can be placed anywhere
in the command line, so that the command line ends with "-- %s", making
paths starting with /U correctly interpreted as paths, not options.
This commit is contained in:
Martin Storsjö 2022-01-11 12:22:42 +02:00
parent aff9f2dc01
commit 18b2385f2b
1 changed files with 10 additions and 0 deletions

View File

@ -40,4 +40,14 @@
// RUN: --start-no-unused-arguments -fsyntax-only --end-no-unused-arguments \
// RUN: -lfoo -Werror %s 2>&1 | FileCheck %s
// Test clang-cl warning about unused linker options.
// RUN: not %clang_cl -fsyntax-only /WX \
// RUN: -LD -- %s 2>&1 | FileCheck %s --check-prefix=CL-WARNING
// Test clang-cl ignoring the warning with --start-no-unused-arguments.
// RUN: %clang_cl -fsyntax-only /WX \
// RUN: --start-no-unused-arguments /LD --end-no-unused-arguments -- %s 2>&1 | count 0
// CHECK: -lfoo: 'linker' input unused
// CL-WARNING: argument unused during compilation: '-LD'