diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2014-07-08 15:55:32 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2014-07-08 15:55:32 +0000 |
commit | 9734280f3344c1843f0417b8b95c5316c5b32683 (patch) | |
tree | 01fc12298a2011c58c2757520779cefe182b1e67 /lldb/source/Interpreter/Options.cpp | |
parent | e693e8f8f0362b08658d0d74bc4c78198aa4ab70 (diff) | |
download | bcm5719-llvm-9734280f3344c1843f0417b8b95c5316c5b32683.tar.gz bcm5719-llvm-9734280f3344c1843f0417b8b95c5316c5b32683.zip |
Fix broken tests due to new error output.
This reverses out the options validators changes. We'll get these
back in once the changes to the output can be resolved.
Restores broken tests on FreeBSD, Linux, MacOSX.
Changes reverted: r212500, r212317, r212290.
llvm-svn: 212543
Diffstat (limited to 'lldb/source/Interpreter/Options.cpp')
-rw-r--r-- | lldb/source/Interpreter/Options.cpp | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp index a8766f5f861..3d65116a45e 100644 --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -277,7 +277,8 @@ Options::GetLongOptions () { const int short_opt = opt_defs[i].short_option; - m_getopt_table[i].definition = &opt_defs[i]; + m_getopt_table[i].name = opt_defs[i].long_option; + m_getopt_table[i].has_arg = opt_defs[i].option_has_arg; m_getopt_table[i].flag = nullptr; m_getopt_table[i].val = short_opt; @@ -296,7 +297,7 @@ Options::GetLongOptions () opt_defs[i].long_option, short_opt, pos->second, - m_getopt_table[pos->second].definition->long_option, + m_getopt_table[pos->second].name, opt_defs[i].long_option); else Host::SystemLog (Host::eSystemLogError, "option[%u] --%s has a short option 0x%x that conflicts with option[%u] --%s, short option won't be used for --%s\n", @@ -304,16 +305,17 @@ Options::GetLongOptions () opt_defs[i].long_option, short_opt, pos->second, - m_getopt_table[pos->second].definition->long_option, + m_getopt_table[pos->second].name, opt_defs[i].long_option); } } //getopt_long_only requires a NULL final entry in the table: - m_getopt_table[i].definition = nullptr; - m_getopt_table[i].flag = nullptr; - m_getopt_table[i].val = 0; + m_getopt_table[i].name = nullptr; + m_getopt_table[i].has_arg = 0; + m_getopt_table[i].flag = nullptr; + m_getopt_table[i].val = 0; } if (m_getopt_table.empty()) @@ -334,29 +336,18 @@ void Options::OutputFormattedUsageText ( Stream &strm, - const OptionDefinition &option_def, + const char *text, uint32_t output_max_columns ) { - std::string actual_text; - if (option_def.validator) - { - const char *condition = option_def.validator->ShortConditionString(); - if (condition) - { - actual_text = "["; - actual_text.append(condition); - actual_text.append("] "); - } - } - actual_text.append(option_def.usage_text); + int len = strlen (text); // Will it all fit on one line? - if (static_cast<uint32_t>(actual_text.length() + strm.GetIndentLevel()) < output_max_columns) + if (static_cast<uint32_t>(len + strm.GetIndentLevel()) < output_max_columns) { // Output it as a single line. - strm.Indent (actual_text.c_str()); + strm.Indent (text); strm.EOL(); } else @@ -366,13 +357,13 @@ Options::OutputFormattedUsageText int text_width = output_max_columns - strm.GetIndentLevel() - 1; int start = 0; int end = start; - int final_end = actual_text.length(); + int final_end = strlen (text); int sub_len; while (end < final_end) { // Don't start the 'text' on a space, since we're already outputting the indentation. - while ((start < final_end) && (actual_text[start] == ' ')) + while ((start < final_end) && (text[start] == ' ')) start++; end = start + text_width; @@ -382,7 +373,7 @@ Options::OutputFormattedUsageText { // If we're not at the end of the text, make sure we break the line on white space. while (end > start - && actual_text[end] != ' ' && actual_text[end] != '\t' && actual_text[end] != '\n') + && text[end] != ' ' && text[end] != '\t' && text[end] != '\n') end--; } @@ -392,7 +383,7 @@ Options::OutputFormattedUsageText strm.Indent(); assert (start < final_end); assert (start + sub_len <= final_end); - strm.Write(actual_text.c_str() + start, sub_len); + strm.Write(text + start, sub_len); start = end + 1; } strm.EOL(); @@ -639,7 +630,7 @@ Options::GenerateOptionUsage strm.Printf ("\n\n"); // Now print out all the detailed information about the various options: long form, short form and help text: - // -short <argument> ( --long_name <argument> ) + // --long_name <argument> ( -short <argument> ) // help text // This variable is used to keep track of which options' info we've printed out, because some options can be in @@ -692,7 +683,7 @@ Options::GenerateOptionUsage if (opt_defs[i].usage_text) OutputFormattedUsageText (strm, - opt_defs[i], + opt_defs[i].usage_text, screen_width); if (opt_defs[i].enum_values != nullptr) { @@ -1035,7 +1026,7 @@ void OptionGroupOptions::Finalize () { m_did_finalize = true; - OptionDefinition empty_option_def = { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }; + OptionDefinition empty_option_def = { 0, false, nullptr, 0, 0, nullptr, 0, eArgTypeNone, nullptr }; m_option_defs.push_back (empty_option_def); } |