diff options
author | Chris Lattner <sabre@nondot.org> | 2002-07-24 20:15:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-07-24 20:15:13 +0000 |
commit | faba809472e36fbb28394da6ed907d2652ca8b83 (patch) | |
tree | d5d5d4f73044c52c6bbb8d991714ba119a3c6013 /support/lib | |
parent | e2c677fd9cf412e77783b1e4d7eee57508a3e6db (diff) | |
download | external_llvm-faba809472e36fbb28394da6ed907d2652ca8b83.zip external_llvm-faba809472e36fbb28394da6ed907d2652ca8b83.tar.gz external_llvm-faba809472e36fbb28394da6ed907d2652ca8b83.tar.bz2 |
Fix a bug exposed by lli
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'support/lib')
-rw-r--r-- | support/lib/Support/CommandLine.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/support/lib/Support/CommandLine.cpp b/support/lib/Support/CommandLine.cpp index cafc14d..433cefd 100644 --- a/support/lib/Support/CommandLine.cpp +++ b/support/lib/Support/CommandLine.cpp @@ -348,8 +348,17 @@ void cl::ParseCommandLineOptions(int &argc, char **argv, unsigned ValNo = 0; for (unsigned j = 1, e = PositionalOpts.size(); j != e; ++j) if (RequiresValue(PositionalOpts[j])) - ErrorParsing |= - ProvidePositionalOption(PositionalOpts[j], PositionalVals[ValNo++]); + ErrorParsing |= ProvidePositionalOption(PositionalOpts[j], + PositionalVals[ValNo++]); + + // Handle the case where there is just one positional option, and it's + // optional. In this case, we want to give JUST THE FIRST option to the + // positional option and keep the rest for the consume after. The above + // loop would have assigned no values to positional options in this case. + // + if (PositionalOpts.size() == 2 && ValNo == 0) + ErrorParsing |= ProvidePositionalOption(PositionalOpts[1], + PositionalVals[ValNo++]); // Handle over all of the rest of the arguments to the // cl::ConsumeAfter command line option... |