Minor bugfix, prevents error in LLI
authorChris Lattner <sabre@nondot.org>
Mon, 22 Jul 2002 02:21:57 +0000 (02:21 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 22 Jul 2002 02:21:57 +0000 (02:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2989 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/CommandLine.cpp
support/lib/Support/CommandLine.cpp

index d11fbd7119e13c2d149e7097a2f8a0a534cf6a85..001fdac476d68829b5d1730d1948a3e5585e92ae 100644 (file)
@@ -168,10 +168,12 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
         ++NumPositionalRequired;
       else if (ConsumeAfterOpt) {
         // ConsumeAfter cannot be combined with "optional" positional options
-        ErrorParsing |=
-          Opt->error(" error - this positional option will never be matched, "
-                     "because it does not Require a value, and a "
-                     "cl::ConsumeAfter option is active!");
+        // unless there is only one positional argument...
+        if (PositionalOpts.size() > 2)
+          ErrorParsing |=
+            Opt->error(" error - this positional option will never be matched, "
+                       "because it does not Require a value, and a "
+                       "cl::ConsumeAfter option is active!");
       } else if (UnboundedFound) {  // This option does not "require" a value...
         // Make sure this option is not specified after an option that eats all
         // extra arguments, or this one will never get any!
index d11fbd7119e13c2d149e7097a2f8a0a534cf6a85..001fdac476d68829b5d1730d1948a3e5585e92ae 100644 (file)
@@ -168,10 +168,12 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
         ++NumPositionalRequired;
       else if (ConsumeAfterOpt) {
         // ConsumeAfter cannot be combined with "optional" positional options
-        ErrorParsing |=
-          Opt->error(" error - this positional option will never be matched, "
-                     "because it does not Require a value, and a "
-                     "cl::ConsumeAfter option is active!");
+        // unless there is only one positional argument...
+        if (PositionalOpts.size() > 2)
+          ErrorParsing |=
+            Opt->error(" error - this positional option will never be matched, "
+                       "because it does not Require a value, and a "
+                       "cl::ConsumeAfter option is active!");
       } else if (UnboundedFound) {  // This option does not "require" a value...
         // Make sure this option is not specified after an option that eats all
         // extra arguments, or this one will never get any!