[OptTable] Improve error message output for grouped short options
authorgbreynoo <Owen.Reynolds@sony.com>
Tue, 31 Aug 2021 15:41:08 +0000 (16:41 +0100)
committergbreynoo <Owen.Reynolds@sony.com>
Tue, 31 Aug 2021 15:41:08 +0000 (16:41 +0100)
commit71d7fed3bc2ad6c22729d446526a59fcfd99bd03
treef0eaf692d5dafd6378e37eb2ffaf6cd032c8c9ff
parentc9948e9254fbb6ea00f66c7b4542311d21e060be
[OptTable] Improve error message output for grouped short options

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.

Differential Revision: https://reviews.llvm.org/D108770
llvm/lib/Option/OptTable.cpp
llvm/test/tools/llvm-objcopy/tool-help-message.test
llvm/unittests/Option/OptionParsingTest.cpp