[PATCH] D57030: [CommandLine] Don't print empty sentinel values from EnumValN lists in help text
Thomas Preud'homme via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 4 03:08:00 PST 2019
thopre added inline comments.
================
Comment at: lib/Support/CommandLine.cpp:1662-1663
+ StringRef ValueName = getOption(i);
+ if (O.getValueExpectedFlag() == ValueOptional && ValueName.empty() &&
+ getDescription(i).empty())
+ continue;
----------------
jhenderson wrote:
> thopre wrote:
> > I wonder if a small inline function for this would make sense. BTW, do you know why the width is not computed from the return value of getOptionInfo?
> I'm not sure I see a `getOptionInfo` function? There is `printOptionInfo` but that does the printing, and needs to know about spacing. I guess you could pull the common logic out into a function, but that would result in it being computed twice for every piece of help text, and would be a different design to the current design.
Sorry yes I meant printOptionInfo. My thought was that printing would be done in a string and then getOptionWidth could be replaced by a strlen of sort. Yes it's a big redesign, I was just musing about it, sorry.
My comment was really about adding a skipOptionValue function that would return true when it's a ValueOptional option with empty value and value description. Trying to factor the rest of the code sounds more difficult but this is easily done.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57030/new/
https://reviews.llvm.org/D57030
More information about the llvm-commits
mailing list