summaryrefslogtreecommitdiffstats
path: root/lldb/tools/driver/Driver.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-12-04 00:32:51 +0000
committerGreg Clayton <gclayton@apple.com>2012-12-04 00:32:51 +0000
commit3bcdfc0ec19df671655eeedb10da2ff9399b8b65 (patch)
tree53fa965c5bbacdfccbef6aff6e5db359ad8fa668 /lldb/tools/driver/Driver.cpp
parent1dd82dd3fc608ee600652a8bf34f6c345354e3b0 (diff)
downloadbcm5719-llvm-3bcdfc0ec19df671655eeedb10da2ff9399b8b65.tar.gz
bcm5719-llvm-3bcdfc0ec19df671655eeedb10da2ff9399b8b65.zip
<rdar://problem/12798131>
Cleaned up the option parsing code to always pass around the short options as integers. Previously we cast this down to "char" and lost some information. I recently added an assert that would detect duplicate short character options which was firing during the test suite. This fix does the following: - make sure all short options are treated as "int" - make sure that short options can be non-printable values when a short option is not required or when an option group is mixed into many commands and a short option is not desired - fix the help printing to "do the right thing" in all cases. Previously if there were duplicate short character options, it would just not emit help for the duplicates - fix option parsing when there are duplicates to parse options correctly. Previously the option parsing, when done for an OptionGroup, would just start parsing options incorrectly by omitting table entries and it would end up setting the wrong option value llvm-svn: 169189
Diffstat (limited to 'lldb/tools/driver/Driver.cpp')
-rw-r--r--lldb/tools/driver/Driver.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index b410f572a6e..7a4eded4572 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -63,7 +63,7 @@ typedef struct
// then this option belongs to option set n.
bool required; // This option is required (in the current usage level)
const char * long_option; // Full name for this option.
- char short_option; // Single character for this option.
+ int short_option; // Single character for this option.
int option_has_arg; // no_argument, required_argument or optional_argument
uint32_t completion_type; // Cookie the option class can use to do define the argument completion.
lldb::CommandArgumentType argument_type; // Type of argument this option takes
@@ -578,7 +578,7 @@ Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &exit)
if (long_options_index >= 0)
{
- const char short_option = (char) g_options[long_options_index].short_option;
+ const int short_option = g_options[long_options_index].short_option;
switch (short_option)
{
OpenPOWER on IntegriCloud