aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-14 21:23:12 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-14 21:23:12 +0000
commitf78925f633e949f06521d9ffd937019e59f35efc (patch)
tree348601c817365be419677b0c11b6b00a5e46f386 /lib/Driver/Driver.cpp
parent0e10031ba5d0f9b3e5bc5570f39382d288779ab8 (diff)
Driver: Dissect -Wl, and -Xlinker arguments to remove --no-demangle, which was a
collect2 option that is passed by some projects (notably WebKit). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105964 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 2ca30f1bac..4351433945 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -114,8 +114,32 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
DerivedArgList *DAL = new DerivedArgList(Args);
for (ArgList::const_iterator it = Args.begin(),
- ie = Args.end(); it != ie; ++it)
+ ie = Args.end(); it != ie; ++it) {
+ const Arg *A = *it;
+
+ // Unfortunately, we have to parse some forwarding options (-Xassembler,
+ // -Xlinker, -Xpreprocessor) because we either integrate their functionality
+ // (assembler and preprocessor), or bypass a previous driver ('collect2').
+ if (A->getOption().matches(options::OPT_Xlinker) &&
+ A->getValue(Args) == llvm::StringRef("--no-demangle")) {
+ DAL->AddFlagArg(A, Opts->getOption(options::OPT_Z_Xlinker__no_demangle));
+ continue;
+ } else if (A->getOption().matches(options::OPT_Wl_COMMA) &&
+ A->containsValue("--no-demangle")) {
+ // Add the rewritten no-demangle argument.
+ DAL->AddFlagArg(A, Opts->getOption(options::OPT_Z_Xlinker__no_demangle));
+
+ // Add the remaining values as Xlinker arguments.
+ for (unsigned i = 0, e = A->getNumValues(); i != e; ++i)
+ if (llvm::StringRef(A->getValue(Args, i)) != "--no-demangle")
+ DAL->AddSeparateArg(A, Opts->getOption(options::OPT_Xlinker),
+ A->getValue(Args, i));
+
+ continue;
+ }
+
DAL->append(*it);
+ }
return DAL;
}
@@ -322,7 +346,7 @@ bool Driver::HandleImmediateArgs(const Compilation &C) {
llvm::outs() << CLANG_VERSION_STRING "\n";
return false;
}
-
+
if (C.getArgs().hasArg(options::OPT__print_diagnostic_categories)) {
PrintDiagnosticCategories(llvm::outs());
return false;
@@ -1230,7 +1254,7 @@ const HostInfo *Driver::GetHostInfo(const char *TripleStr) const {
// TCE is an osless target
if (Triple.getArchName() == "tce")
- return createTCEHostInfo(*this, Triple);
+ return createTCEHostInfo(*this, Triple);
switch (Triple.getOS()) {
case llvm::Triple::AuroraUX: