2013-09-11 04:35:58 +08:00
|
|
|
// Note: %s must be preceded by --, otherwise it may be interpreted as a
|
|
|
|
// command-line option, e.g. on Mac where %s is commonly under /Users.
|
|
|
|
|
|
|
|
// RUN: %clang_cl /TC -### -- %s 2>&1 | FileCheck -check-prefix=TC %s
|
|
|
|
// TC: "-x" "c"
|
|
|
|
// TC-NOT: warning
|
|
|
|
// TC-NOT: note
|
|
|
|
|
|
|
|
// RUN: %clang_cl /TP -### -- %s 2>&1 | FileCheck -check-prefix=TP %s
|
|
|
|
// TP: "-x" "c++"
|
|
|
|
// TP-NOT: warning
|
|
|
|
// TP-NOT: note
|
|
|
|
|
|
|
|
// RUN: %clang_cl -### /Tc%s /TP -- %s 2>&1 | FileCheck -check-prefix=Tc %s
|
|
|
|
// RUN: %clang_cl -### /TP /Tc%s -- %s 2>&1 | FileCheck -check-prefix=Tc %s
|
|
|
|
// Tc: "-x" "c"
|
|
|
|
// Tc: "-x" "c++"
|
|
|
|
// Tc-NOT: warning
|
|
|
|
// Tc-NOT: note
|
|
|
|
|
|
|
|
// RUN: %clang_cl -### /Tp%s /TC -- %s 2>&1 | FileCheck -check-prefix=Tp %s
|
|
|
|
// RUN: %clang_cl -### /TC /Tp%s -- %s 2>&1 | FileCheck -check-prefix=Tp %s
|
|
|
|
// Tp: "-x" "c++"
|
|
|
|
// Tp: "-x" "c"
|
|
|
|
// Tp-NOT: warning
|
|
|
|
// Tp-NOT: note
|
|
|
|
|
|
|
|
// RUN: %clang_cl /TP /TC /TP -### -- %s 2>&1 | FileCheck -check-prefix=WARN %s
|
|
|
|
// WARN: warning: overriding '/TP' option with '/TC'
|
|
|
|
// WARN: warning: overriding '/TC' option with '/TP'
|
|
|
|
// WARN: note: The last /TC or /TP option takes precedence over earlier instances
|
|
|
|
// WARN-NOT: note
|
2014-01-29 09:04:40 +08:00
|
|
|
|
2015-07-15 18:45:25 +08:00
|
|
|
// MSYS2_ARG_CONV_EXCL tells MSYS2 to skip conversion of the specified argument.
|
Reapply: [clang-cl] Always interpret the LIB env var as separated with semicolons
When cross compiling with clang-cl, clang splits the INCLUDE env
variable around semicolons (clang/lib/Driver/ToolChains/MSVC.cpp,
MSVCToolChain::AddClangSystemIncludeArgs) and lld splits the
LIB variable similarly (lld/COFF/Driver.cpp,
LinkerDriver::addLibSearchPaths). Therefore, the consensus for
cross compilation with clang-cl and lld-link seems to be to use
semicolons, despite path lists normally being separated by colons
on unix and EnvPathSeparator being set to that.
Therefore, handle the LIB variable similarly in Clang, when
handling lib file arguments when driving linking via Clang.
This fixes commands like "clang-cl test.c -Fetest.exe kernel32.lib" in
a cross compilation setting. Normally, most users call (lld-)link
directly, but meson happens to use this command syntax for
has_function() tests.
Reapply: Change Program.h to define procid_t as ::pid_t. When included
in lldb/unittests/Host/NativeProcessProtocolTest.cpp, it is included
after an lldb namespace containing an lldb::pid_t typedef, followed
later by a "using namespace lldb;". Previously, Program.h wasn't
included in this translation unit, but now it ends up included
transitively from Process.h.
Differential Revision: https://reviews.llvm.org/D88002
2020-09-21 04:19:12 +08:00
|
|
|
// Add a dummy "other" entry to the path as well, to check that it's split
|
|
|
|
// around semicolons even on unix.
|
|
|
|
// RUN: env LIB="other;%S/Inputs/cl-libs" MSYS2_ARG_CONV_EXCL="/TP;/c" %clang_cl /c /TP cl-test.lib -### 2>&1 | FileCheck -check-prefix=TPlib %s
|
2014-09-13 02:15:10 +08:00
|
|
|
// TPlib: warning: cl-test.lib: 'linker' input unused
|
2014-09-13 05:44:24 +08:00
|
|
|
// TPlib: warning: argument unused during compilation: '/TP'
|
2014-09-13 02:15:10 +08:00
|
|
|
// TPlib-NOT: cl-test.lib
|
|
|
|
|
2015-07-15 18:45:25 +08:00
|
|
|
// RUN: env LIB=%S/Inputs/cl-libs MSYS2_ARG_CONV_EXCL="/TC;/c" %clang_cl /c /TC cl-test.lib -### 2>&1 | FileCheck -check-prefix=TClib %s
|
2014-09-13 02:15:10 +08:00
|
|
|
// TClib: warning: cl-test.lib: 'linker' input unused
|
2014-09-13 05:44:24 +08:00
|
|
|
// TClib: warning: argument unused during compilation: '/TC'
|
2014-09-13 02:15:10 +08:00
|
|
|
// TClib-NOT: cl-test.lib
|
|
|
|
|
2014-01-29 09:04:40 +08:00
|
|
|
// RUN: not %clang_cl - 2>&1 | FileCheck -check-prefix=STDIN %s
|
|
|
|
// STDIN: error: use /Tc or /Tp
|
|
|
|
|
|
|
|
// RUN: %clang_cl -### /Tc - 2>&1 | FileCheck -check-prefix=STDINTc %s
|
|
|
|
// STDINTc: "-x" "c"
|
|
|
|
|
2021-03-19 21:37:19 +08:00
|
|
|
// RUN: env LIB=%S/Inputs/cl-libs %clang_cl -fuse-ld=link -### -- %s cl-test.lib 2>&1 | FileCheck -check-prefix=LIBINPUT %s
|
2014-06-19 05:34:36 +08:00
|
|
|
// LIBINPUT: link.exe"
|
2014-06-19 01:21:50 +08:00
|
|
|
// LIBINPUT: "cl-test.lib"
|
|
|
|
|
2021-03-19 21:37:19 +08:00
|
|
|
// RUN: env LIB=%S/Inputs/cl-libs %clang_cl -fuse-ld=link -### -- %s cl-test2.lib 2>&1 | FileCheck -check-prefix=LIBINPUT2 %s
|
2014-06-19 01:21:50 +08:00
|
|
|
// LIBINPUT2: error: no such file or directory: 'cl-test2.lib'
|
2014-06-19 05:34:36 +08:00
|
|
|
// LIBINPUT2: link.exe"
|
2014-06-19 01:21:50 +08:00
|
|
|
// LIBINPUT2-NOT: "cl-test2.lib"
|
|
|
|
|
2021-03-19 21:37:19 +08:00
|
|
|
// RUN: %clang_cl -fuse-ld=link -### -- %s /nonexisting.lib 2>&1 | FileCheck -check-prefix=LIBINPUT3 %s
|
2015-04-25 06:16:53 +08:00
|
|
|
// LIBINPUT3: error: no such file or directory: '/nonexisting.lib'
|
|
|
|
// LIBINPUT3: link.exe"
|
|
|
|
// LIBINPUT3-NOT: "/nonexisting.lib"
|
|
|
|
|
2014-01-29 09:04:40 +08:00
|
|
|
void f();
|