diff options
author | Hans Wennborg <hans@hanshq.net> | 2013-08-08 16:54:31 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2013-08-08 16:54:31 +0000 |
commit | 61db3478dc16bd4950f0cad8fe7bbc4bf983217f (patch) | |
tree | 0662f57c4c9e773f80f91ca685f2e5e9cee5b00f | |
parent | 001ba2ec0bf70bc6631f07cc9b061c96bd8a9505 (diff) | |
download | bcm5719-llvm-61db3478dc16bd4950f0cad8fe7bbc4bf983217f.tar.gz bcm5719-llvm-61db3478dc16bd4950f0cad8fe7bbc4bf983217f.zip |
clang-cl: Hook up /Za to prevent adding oldnames.lib dependency
The /Za flag should probably do more, but let's start with this.
Differential Revision: http://llvm-reviews.chandlerc.com/D1320
llvm-svn: 187991
-rw-r--r-- | clang/include/clang/Driver/CLCompatOptions.td | 1 | ||||
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 9 | ||||
-rw-r--r-- | clang/test/Driver/cl-Za.c | 11 |
3 files changed, 17 insertions, 4 deletions
diff --git a/clang/include/clang/Driver/CLCompatOptions.td b/clang/include/clang/Driver/CLCompatOptions.td index e98d8e85164..197ae9ebe5f 100644 --- a/clang/include/clang/Driver/CLCompatOptions.td +++ b/clang/include/clang/Driver/CLCompatOptions.td @@ -98,6 +98,7 @@ def _SLASH_TC : CLFlag<"TC">, HelpText<"Treat all source files as C">; def _SLASH_Tp : CLJoinedOrSeparate<"Tp">, HelpText<"Specify a C++ source file">, MetaVarName<"<filename>">; def _SLASH_TP : CLFlag<"TP">, HelpText<"Treat all source files as C++">; +def _SLASH_Za : CLFlag<"Za">; // Ignored: diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index fb27bfde628..a1193f54733 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -3719,10 +3719,11 @@ void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs) const { llvm_unreachable("Unexpected option ID."); } - // This provides POSIX compatibility (maps 'open' to '_open'), which most users - // want. MSVC has a switch to turn off this autolinking, but it's not - // implemented in clang yet. - CmdArgs.push_back("--dependent-lib=oldnames"); + if (!Args.hasArg(options::OPT__SLASH_Za)) { + // This provides POSIX compatibility (maps 'open' to '_open'), + // which most users want. + CmdArgs.push_back("--dependent-lib=oldnames"); + } } void ClangAs::ConstructJob(Compilation &C, const JobAction &JA, diff --git a/clang/test/Driver/cl-Za.c b/clang/test/Driver/cl-Za.c new file mode 100644 index 00000000000..b1cb0b785bd --- /dev/null +++ b/clang/test/Driver/cl-Za.c @@ -0,0 +1,11 @@ +// Don't attempt slash switches on msys bash. +// REQUIRES: shell-preserves-root + +// 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 -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULT %s +// DEFAULT: "--dependent-lib=oldnames" + +// RUN: %clang_cl /Za -### -- %s 2>&1 | FileCheck -check-prefix=Za %s +// Za-NOT: "--dependent-lib=oldnames" |