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

Owen Reynolds via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 26 09:03:48 PDT 2021


gbreynoo created this revision.
gbreynoo added reviewers: MaskRay, awarzynski, grimar.
Herald added subscribers: rupprecht, hiraditya.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: rupprecht.
Herald added a reviewer: jhenderson.
gbreynoo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As seen in https://bugs.llvm.org/show_bug.cgi?id=48880 the current implementation for parsing grouped short options can return unclear error messages.

This change fixes the example given in the ticket in which a flag is incorrectly given an argument. Also when parsing a group we now keep reading past the first incorrect option and output errors for all incorrect options in the group.

This change includes additional test cases added to `llvm-symbolizer/unknown-argument.test` and fixes up `llvm-objcopy/tool-help-message.test` due to the change in error output. Note that due to implementation of llvm-objcopy only the first incorrect argument is output.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108770

Files:
  llvm/lib/Option/OptTable.cpp
  llvm/test/tools/llvm-objcopy/tool-help-message.test
  llvm/test/tools/llvm-symbolizer/unknown-argument.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108770.368899.patch
Type: text/x-patch
Size: 5959 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210826/51f6791b/attachment.bin>


More information about the llvm-commits mailing list