[Lldb-commits] [PATCH] D63770: Options: Reduce code duplication

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 25 07:50:36 PDT 2019

labath created this revision.
labath added reviewers: mgorny, aprantl.

While investigating breakages caused by D63110 <https://reviews.llvm.org/D63110>, I noticed we were
building the short options strings in three places. Some of them used a
leading ':' to detect missing arguments, and some didn't. This was the
indirect cause of D63110 <https://reviews.llvm.org/D63110>. Here, I move the common code into a utility

Also, unify the code which appends the sentinel value at the end of the
option vector, and make it harder for users to pass invalid argc-argv
combos to getopt (another component of D63110 <https://reviews.llvm.org/D63110>) by having the
OptionParser::Parse function take a (Mutable)ArrayRef.

This unification has uncovered that we don't handle missing arguments
while building aliases, However, it's not possible to write an effective
test for this, as right now it is not possible to return an error out of
the alias parsing code (which means we are printing the generic
"failure" message even after this patch).



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63770.206447.patch
Type: text/x-patch
Size: 9012 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190625/4009f9d8/attachment-0001.bin>

More information about the lldb-commits mailing list