summaryrefslogtreecommitdiffstats
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
commit63d2d1f554216cf7a27c05b034398fd9acb4fb3f (patch)
tree1230fa26bb4af2a64f73fa2568e20c3e8070575c
parent4d1767199777ae11d8e529b5a640bc3b1dfa7473 (diff)
downloadbcm5719-llvm-63d2d1f554216cf7a27c05b034398fd9acb4fb3f.tar.gz
bcm5719-llvm-63d2d1f554216cf7a27c05b034398fd9acb4fb3f.zip
Fix a bug that caused opt and other tools to silently ignore
invalid command-line options. llvm-svn: 47523
-rw-r--r--llvm/lib/Support/CommandLine.cpp2
-rw-r--r--llvm/test/Other/invalid-commandline-option.ll3
2 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 4fe1aa1112c..486875210fd 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/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/llvm/test/Other/invalid-commandline-option.ll b/llvm/test/Other/invalid-commandline-option.ll
new file mode 100644
index 00000000000..b74c49857e3
--- /dev/null
+++ b/llvm/test/Other/invalid-commandline-option.ll
@@ -0,0 +1,3 @@
+; RUN: llvm-as < /dev/null | not opt --foo > /dev/null
+
+; there is no --foo
OpenPOWER on IntegriCloud