[PATCH] D78476: [dsymutil] Fix short options displayed in the help message.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 00:29:43 PDT 2020


jhenderson added a comment.

In D78476#2004599 <https://reviews.llvm.org/D78476#2004599>, @Higuoxing wrote:

> In D78476#1992621 <https://reviews.llvm.org/D78476#1992621>, @aprantl wrote:
>
> > Not sure how applicable this is here, but I wanted to point out that we do have a test specifically for the help text `llvm/test/tools/dsymutil/cmdline.test`. Perhaps this patch can be tested there.
>
>
> Hi @aprantl
>
> Sorry for the late response. I've checked `cmdline.test`, and these options are checked in this way.
>
>   dsymutil --help | FileCheck %s --check-prefix=HELP
>   HELP: -option1
>   HELP: -option2
>
>
> However, `-option` matches both `--option` and `-option`. I've also checked other tools' `cmdline.test/help.test`, which are similar to `dsymutil`'s. I guess we should use regex patterns to exactly match what we want? Do you have any suggestion?


Assuming we want only "--option1" to be matched, why not simply change the text to `--option1`? If we want to allow either version, then `-option1` is fine, or you could be more specific with `{{-?}}-option1`. Finally, you could also ensure there'se a space before the option by doing `{{ }}--option1` or even `{{ -?}}-option1`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78476





More information about the llvm-commits mailing list