[llvm-commits] [llvm] r47523 - in /llvm/trunk: lib/Support/CommandLine.cpp test/Other/invalid-commandline-option.ll

Dan Gohman gohman at apple.com
Fri Feb 22 17:55:25 PST 2008


Author: djg
Date: Fri Feb 22 19:55:25 2008
New Revision: 47523

URL: http://llvm.org/viewvc/llvm-project?rev=47523&view=rev
Log:
Fix a bug that caused opt and other tools to silently ignore
invalid command-line options.

Added:
    llvm/trunk/test/Other/invalid-commandline-option.ll
Modified:
    llvm/trunk/lib/Support/CommandLine.cpp

Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=47523&r1=47522&r2=47523&view=diff

==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Fri Feb 22 19:55:25 2008
@@ -127,7 +127,7 @@
     // Remember information about positional options.
     if (O->getFormattingFlag() == cl::Positional)
       PositionalOpts.push_back(O);
-    else if (O->getMiscFlags() && cl::Sink) // Remember sink options
+    else if (O->getMiscFlags() & cl::Sink) // Remember sink options
       SinkOpts.push_back(O);
     else if (O->getNumOccurrencesFlag() == cl::ConsumeAfter) {
       if (CAOpt)

Added: llvm/trunk/test/Other/invalid-commandline-option.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/invalid-commandline-option.ll?rev=47523&view=auto

==============================================================================
--- llvm/trunk/test/Other/invalid-commandline-option.ll (added)
+++ llvm/trunk/test/Other/invalid-commandline-option.ll Fri Feb 22 19:55:25 2008
@@ -0,0 +1,3 @@
+; RUN: llvm-as < /dev/null | not opt --foo > /dev/null
+
+; there is no --foo





More information about the llvm-commits mailing list