Goint to use it in LLD.
In short this is PR30422, previously LLD did not show
aliases in help text. With this it is possible.
Details
Diff Detail
Event Timeline
Ok. Going to rebase this after rL308293 though.
But just in case - the way we will choose for LLD (render all or some of aliases)
should not affect this patch (except if we choose possible way to ignore aliases
rendering at all, which I believe not an option).
Because this patch only implements aliases rendering, and hidden flags handling is
independent and already was implemented before this change.
- Reimplemented.
ShowAliases flag allows to specify that alias should take HelpText from its
parent option. In that case we can have for example:
def auxiliary: S<"auxiliary">, HelpText<"Set DT_AUXILIARY field to the specified name">; def alias_auxiliary: Separate<["-"], "f">, Alias<auxiliary>;
and show both options in help:
--auxiliary <value> Set DT_AUXILIARY field to the specified name -f <value> Set DT_AUXILIARY field to the specified name
Without that change we would render only first line in --help.
The new behavior is probably fine, but I don't think you needed to change the parameter name.
I changed newly introduced ShowAliases to InferHelpText because first one is not completelly correctly
reflects the action performed.
If we have HelpText specified for alias:
def alias_version_V: Flag<["-"], "V">, Alias<version>, HelpText<"blah blah">;
then regardless of ShowAliases flag value, this option will be shown.
Because old logic prints all options with HelpText at first place (and I did not change it here).
Probably we can name it ShowAllAliases ? With description saying it will trigger rendering all
aliases regardless they have HelpText explicitly set or not.
LGTM
include/llvm/Option/OptTable.h | ||
---|---|---|
194–197 | If true, display all options including aliases that don't have help texts. By default, we display only options that are not hidden and have help texts. | |
lib/Option/OptTable.cpp | ||
478–481 | If an alias doesn't have a help text, show a help text for the aliased option instead. |
If true, display all options including aliases that don't have help texts. By default, we display only options that are not hidden and have help texts.