It's actually a bit of work.  

Right now, all the default values are set in the OptionParsingStarting method 
of the Options subclass in the CommandObject subclass that implements the 
command.  So the only entity that knows the default value of an option is the 
state of the associated ivar in the Option object right after 
OptionParsingStarting.  And the relation between option flag and the variable 
that stores the flag value in the Options (and thus has the default value) is 
some arbitrary choice made by the Option class. There isn't even a general way 
to ask: "what ivar stores the option value for command option 'a'?" since it's 
up to Options::SetOptionValue to stuff values in ivars, and only the parse 
function knows which ivar went with which option flag.

You'd have to come up with some way to encode default values in the options 
tables, and then change over OptionParsingStarting to read the default values 
from the tables.  You'd also have to deal with the OptionGroups which do things 
differently.  I think once you started into a task like this, you'd end up 
rewriting a substantial portion of the option parsing machinery.  That in 
itself would not be a bad thing, there are some crusty aspects of the command 
parser in general that we should revise at some point.  But it ain't a Friday 
afternoon hack.

Jim


> On Feb 6, 2015, at 11:42 AM, Zachary Turner <[email protected]> wrote:
> 
> This sounds like an easy patch.  Is it subtly more complicated than it
> sounds?  If it's actually easy as it sounds, I'll just do it.
> 
> 
> http://reviews.llvm.org/D7468
> 
> EMAIL PREFERENCES
>  http://reviews.llvm.org/settings/panel/emailpreferences/
> 
> 


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to