[PATCH] D108770: [OptTable] Improve error message output for grouped short options

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 27 00:09:06 PDT 2021


jhenderson added inline comments.


================
Comment at: llvm/lib/Option/OptTable.cpp:379
     if (Arg *A = Opt.accept(Args, Str.substr(0, 2), true, Index)) {
-      if (Str.size() == 2)
-        ++Index;
-      else
-        Args.replaceArgString(Index, Twine('-') + Str.substr(2));
+      // Check that the last option isn't a flag wrongly given an argument
+      if (Str[2] == '=')
----------------
MaskRay wrote:
> gbreynoo wrote:
> > I could not find a case in which we would enter `if (Str.size() == 2)` so I have removed it. I think either the option would have already been accepted or we want to create the an Arg as unknown option. 
> This is ok



================
Comment at: llvm/lib/Option/OptTable.cpp:389
+  // In the case of an incorrect short option extract the character and move to
+  // the next one
+  if (Str[1] != '-') {
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108770/new/

https://reviews.llvm.org/D108770



More information about the llvm-commits mailing list