diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 4fe1aa1112c..486875210fd 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -127,7 +127,7 @@ static void GetOptionInfo(std::vector &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 00000000000..b74c49857e3 --- /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