[PATCH] D58499: [CommandLine] Do not crash if an option has both ValueRequired and Grouping.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 21 04:00:28 PST 2019


jhenderson added a comment.

According to the documentation (https://llvm.org/docs/CommandLine.html#controlling-other-formatting-options) this is illegal even for the last value:

>   Note that cl::Grouping options cannot have values.

Does it just work? If so, great, but please update the docs.

Regardless, we certainly shouldn't be asserting if we can get into that state, so this is a good change.

Your description mentioned ValueRequired. What happens for ValueOptional? I want to make sure that it doesn't treat the other grouped letters after it as the option's value.



================
Comment at: unittests/Support/CommandLineTest.cpp:1146
+
+  // Should not crash if it is accidentally used in the middle of a group.
+  const char *args2[] = {"prog", "-vf", "val2"};
----------------
The first option isn't really in the middle, after all, so this comment should be adjusted to say "elswhere in the group" or "not at the end of a group" or similar.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58499





More information about the llvm-commits mailing list