r187991 - clang-cl: Hook up /Za to prevent adding oldnames.lib dependency

Hans Wennborg hans at hanshq.net
Thu Aug 8 09:54:31 PDT 2013


Author: hans
Date: Thu Aug  8 11:54:31 2013
New Revision: 187991

URL: http://llvm.org/viewvc/llvm-project?rev=187991&view=rev
Log:
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

Added:
    cfe/trunk/test/Driver/cl-Za.c
Modified:
    cfe/trunk/include/clang/Driver/CLCompatOptions.td
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=187991&r1=187990&r2=187991&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Thu Aug  8 11:54:31 2013
@@ -98,6 +98,7 @@ def _SLASH_TC : CLFlag<"TC">, HelpText<"
 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:

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=187991&r1=187990&r2=187991&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug  8 11:54:31 2013
@@ -3719,10 +3719,11 @@ void Clang::AddClangCLArgs(const ArgList
       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,

Added: cfe/trunk/test/Driver/cl-Za.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-Za.c?rev=187991&view=auto
==============================================================================
--- cfe/trunk/test/Driver/cl-Za.c (added)
+++ cfe/trunk/test/Driver/cl-Za.c Thu Aug  8 11:54:31 2013
@@ -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"





More information about the cfe-commits mailing list