aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-02-23 01:55:25 +0000
committerDan Gohman <gohman@apple.com>2008-02-23 01:55:25 +0000
commit61e015fe7426ca97c3c7afb583f04f5f93050370 (patch)
tree0c0374ef135afd0633746c6348863ee2d3f6f5c2
parentb2a0abce1ed97d6642f91e10114f22e824d933cb (diff)
Fix a bug that caused opt and other tools to silently ignore
invalid command-line options. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47523 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Support/CommandLine.cpp2
-rw-r--r--test/Other/invalid-commandline-option.ll3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index 4fe1aa1112..486875210f 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -127,7 +127,7 @@ static void GetOptionInfo(std::vector<Option*> &PositionalOpts,
// 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)
diff --git a/test/Other/invalid-commandline-option.ll b/test/Other/invalid-commandline-option.ll
new file mode 100644
index 0000000000..b74c49857e
--- /dev/null
+++ b/test/Other/invalid-commandline-option.ll
@@ -0,0 +1,3 @@
+; RUN: llvm-as < /dev/null | not opt --foo > /dev/null
+
+; there is no --foo