[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 01:34:51 PDT 2020


jhenderson added a comment.

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

> In D78476#2007080 <https://reviews.llvm.org/D78476#2007080>, @jhenderson wrote:
>
> > 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`.
>
>
> Sorry for the misleading, in this patch, I changed some long options (`--o`, `--y`) to (`-o` and `-y`), however, for example, pattern `"-o"` matches both `--o` and `-o`. I am wondering, is there any way to match exactly `-o`? I've checked other LLVM tools, and it seems that there is no such pattern?


Ah, okay. FileCheck has "--match-full-lines" as one option, but it's probably not what you want in this case, as there will be other text on the same line that you don't want. Assuming there is whitespace before and after the option name, you can adapt the second-to last of my suggestions above to `{{ }}-o{{ }}` or even `{{ -o }}`. Spaces within the regex will be forcibly matched which should solve your problems. You can also use `^` and `$` for regex markers for the start* and end of a line.

- "start" here means the end of the previous match, if on the same line as the current one, or the start of the line otherwise.


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