[Lldb-commits] [PATCH] Close terminal after LaunchInTerminalTestCase test

Jim Ingham jingham at apple.com
Fri Feb 6 11:57:18 PST 2015

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.




More information about the lldb-commits mailing list