Reland r341390 clang-cl: Pass /Brepro to linker if it was passed to the compiler

The test was missing  '--' on mac as pointed out by -Wslash-u-filename:
<stdin>:5:69: note: possible intended match here
clang: warning: '/Users/thakis/src/llvm-mono/clang/test/Driver/msvc-link.c' treated as the '/U' option [-Wslash-u-filename]

Differential Revision: https://reviews.llvm.org/D51635


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341654 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nico Weber 2018-09-07 12:47:02 +00:00
parent 30f22e0d51
commit bee620fc61
2 changed files with 21 additions and 0 deletions

View File

@ -355,6 +355,15 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
options::OPT__SLASH_Zd))
CmdArgs.push_back("-debug");
// Pass on /Brepro if it was passed to the compiler.
// Note that /Brepro maps to -mno-incremental-linker-compatible.
bool DefaultIncrementalLinkerCompatible =
C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment();
if (!Args.hasFlag(options::OPT_mincremental_linker_compatible,
options::OPT_mno_incremental_linker_compatible,
DefaultIncrementalLinkerCompatible))
CmdArgs.push_back("-Brepro");
bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd,
options::OPT_shared);
if (DLL) {

View File

@ -3,6 +3,7 @@
// BASIC: "-out:a.exe"
// BASIC: "-defaultlib:libcmt"
// BASIC: "-nologo"
// BASIC-NOT: "-Brepro"
// RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -### %s 2>&1 | FileCheck --check-prefix=DLL %s
// DLL: link.exe"
@ -16,3 +17,14 @@
// LIBPATH: "-libpath:/usr/lib"
// LIBPATH: "-nologo"
// RUN: %clang_cl /Brepro -### -- %s 2>&1 | FileCheck --check-prefix=REPRO %s
// REPRO: link.exe"
// REPRO: "-out:msvc-link.exe"
// REPRO: "-nologo"
// REPRO: "-Brepro"
// RUN: %clang_cl /Brepro- -### -- %s 2>&1 | FileCheck --check-prefix=NOREPRO %s
// NOREPRO: link.exe"
// NOREPRO: "-out:msvc-link.exe"
// NOREPRO: "-nologo"
// NOREPRO-NOT: "-Brepro"