[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...
Size: 9012 bytes
Desc: not available
More information about the lldb-commits