[lld] r195597 - [Gnu] Ignore unknown arguments, and print message.
Shankar Easwaran
shankare at codeaurora.org
Sun Nov 24 20:22:12 PST 2013
Author: shankare
Date: Sun Nov 24 22:22:11 2013
New Revision: 195597
URL: http://llvm.org/viewvc/llvm-project?rev=195597&view=rev
Log:
[Gnu] Ignore unknown arguments, and print message.
Added:
lld/trunk/test/elf/ignore-unknownoption.test
Modified:
lld/trunk/lib/Driver/GnuLdDriver.cpp
Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=195597&r1=195596&r2=195597&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Sun Nov 24 22:22:11 2013
@@ -160,6 +160,13 @@ bool GnuLdDriver::parse(int argc, const
int index = 0;
+ // Ignore unknown arguments.
+ for (auto it = parsedArgs->filtered_begin(OPT_UNKNOWN),
+ ie = parsedArgs->filtered_end();
+ it != ie; ++it)
+ diagnostics << "warning: ignoring unknown argument: " << (*it)->getValue()
+ << "\n";
+
// Set sys root path.
if (llvm::opt::Arg *sysRootPath = parsedArgs->getLastArg(OPT_sysroot))
ctx->setSysroot(sysRootPath->getValue());
Added: lld/trunk/test/elf/ignore-unknownoption.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/ignore-unknownoption.test?rev=195597&view=auto
==============================================================================
--- lld/trunk/test/elf/ignore-unknownoption.test (added)
+++ lld/trunk/test/elf/ignore-unknownoption.test Sun Nov 24 22:22:11 2013
@@ -0,0 +1,5 @@
+# This test tests that lld is able to print unknown options that are not
+# recognized.
+RUN: not lld -flavor gnu -target x86_64 --gc-sections 2> %t
+RUN: FileCheck %s < %t
+CHECK: warning: ignoring unknown argument: --gc-sections
More information about the llvm-commits
mailing list