Skip to content

Commit

Permalink
Reland r341390 clang-cl: Pass /Brepro to linker if it was passed to t…
Browse files Browse the repository at this point in the history
…he 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

llvm-svn: 341654
  • Loading branch information
nico committed Sep 7, 2018
1 parent d946778 commit 50824c9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions clang/lib/Driver/ToolChains/MSVC.cpp
Expand Up @@ -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) {
Expand Down
12 changes: 12 additions & 0 deletions clang/test/Driver/msvc-link.c
Expand Up @@ -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"
Expand All @@ -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"

0 comments on commit 50824c9

Please sign in to comment.