Hi rnk,
This makes the /Za command-line flag disable inclusion of oldnames.lib as a
dependency in object files. It's possible this flag should be doing more stuff,
and therefore I haven't given it a HelpText, but this is a start.
http://llvm-reviews.chandlerc.com/D1320
Files:
include/clang/Driver/CLCompatOptions.td
lib/Driver/Tools.cpp
test/Driver/cl-Za.c
Index: include/clang/Driver/CLCompatOptions.td
===================================================================
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -98,6 +98,7 @@
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:
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3842,10 +3842,11 @@
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,
Index: test/Driver/cl-Za.c
===================================================================
--- /dev/null
+++ 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"
Index: include/clang/Driver/CLCompatOptions.td
===================================================================
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -98,6 +98,7 @@
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:
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3842,10 +3842,11 @@
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,
Index: test/Driver/cl-Za.c
===================================================================
--- /dev/null
+++ 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"
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits