This patch adds PrintArgInline (after PrintArg) that strips the
leading spaces from an argument before printing them, for usage
inline.
Related bug: PR42943 https://bugs.llvm.org/show_bug.cgi?id=42943
Differential D69501
[CommandLine] Add inline ArgName printing dsprenkels on Oct 28 2019, 2:44 AM. Authored by
Details This patch adds PrintArgInline (after PrintArg) that strips the Related bug: PR42943 https://bugs.llvm.org/show_bug.cgi?id=42943
Diff Detail
Event TimelineComment Actions Hi @dsprenkels, Thanks for the patch. I've just got back from a couple of weeks off, and have a lot to catch up on, but I'll get back to reviewing this in due course (it may be a few days, depending on how things go). In the meantime, you might want to look at who else has recently modified this file and add them as reviewers too. You also should add one or more tests to show that the bug this issue fixes has been fixed. Comment Actions @jhenderson, I added the test. The only person that has modified llvm/lib/Support/CommandLine.cpp a couple of times in the last year is @hintonda. I added them as a reviewer. Comment Actions Thanks for the patch. I originally added this to cleanup printing help, so I appreciate you fixing the error messages too.
Comment Actions I think adding an extra constructor argument to PrintArg might be the way forward. There are several places that add additional spaces before the PrintArg call (see e.g. printGenericOptionDiff and printOptionInfo in generic_parser_base), where the spaces could be combined with the two implicitly added currently, I think by specifying, e.g. "4" as the extra argument. The alternative is to go the other way and remove the spaces that PrintArg automatically adds, and then add them in the relevant places explicitly. I'm not sure how clean that would be though. Comment Actions Not that it matters, but something odd has happened with your context: the CommandLineTest.cpp file is missing all context after your change. I suspect it's the end of the file, but it might mean you've got a mistake in whatever you are using to create the diff.
Comment Actions @jhenderson, you were right. I forgot how to upload patches correctly, and that is how the context got lost. The new diff (226891) should be exported correctly. Thanks for the heads-up. Comment Actions Aside from one formatting nit, this looks good to me. Please let @hintonda provide any more comments though before this gets committed.
Comment Actions Fixed formatting using clang-format.
As you might have noticed, this is my first review on Phabricator. Thanks for your patience. :) Comment Actions I see you haven't landed this yet. Do you have commit rights? If not, I'd be happy to land it for you. Comment Actions I don't have commit right. This is one of my first patches. Can you do it for me please? |
This should be static.