aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Interpreter/Options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/lldb/source/Interpreter/Options.cpp')
-rw-r--r--contrib/llvm-project/lldb/source/Interpreter/Options.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/contrib/llvm-project/lldb/source/Interpreter/Options.cpp b/contrib/llvm-project/lldb/source/Interpreter/Options.cpp
index c14b6b6ce66a..9ecc9e229e0e 100644
--- a/contrib/llvm-project/lldb/source/Interpreter/Options.cpp
+++ b/contrib/llvm-project/lldb/source/Interpreter/Options.cpp
@@ -223,7 +223,7 @@ Option *Options::GetLongOptions() {
std::map<int, uint32_t>::const_iterator pos =
option_seen.find(short_opt);
StreamString strm;
- if (isprint8(short_opt))
+ if (defs[i].HasShortOption())
Host::SystemLog(Host::eSystemLogError,
"option[%u] --%s has a short option -%c that "
"conflicts with option[%u] --%s, short option won't "
@@ -355,9 +355,7 @@ enum OptionDisplayType {
static bool PrintOption(const OptionDefinition &opt_def,
OptionDisplayType display_type, const char *header,
const char *footer, bool show_optional, Stream &strm) {
- const bool has_short_option = isprint8(opt_def.short_option) != 0;
-
- if (display_type == eDisplayShortOption && !has_short_option)
+ if (display_type == eDisplayShortOption && !opt_def.HasShortOption())
return false;
if (header && header[0])
@@ -366,7 +364,7 @@ static bool PrintOption(const OptionDefinition &opt_def,
if (show_optional && !opt_def.required)
strm.PutChar('[');
const bool show_short_option =
- has_short_option && display_type != eDisplayLongOption;
+ opt_def.HasShortOption() && display_type != eDisplayLongOption;
if (show_short_option)
strm.Printf("-%c", opt_def.short_option);
else
@@ -445,7 +443,7 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
std::set<int> options;
std::set<int>::const_iterator options_pos, options_end;
for (auto &def : opt_defs) {
- if (def.usage_mask & opt_set_mask && isprint8(def.short_option)) {
+ if (def.usage_mask & opt_set_mask && def.HasShortOption()) {
// Add current option to the end of out_stream.
if (def.required && def.option_has_arg == OptionParser::eNoArgument) {
@@ -470,7 +468,7 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
options.clear();
for (auto &def : opt_defs) {
- if (def.usage_mask & opt_set_mask && isprint8(def.short_option)) {
+ if (def.usage_mask & opt_set_mask && def.HasShortOption()) {
// Add current option to the end of out_stream.
if (!def.required &&
@@ -498,7 +496,7 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
// First go through and print the required options (list them up front).
for (auto &def : opt_defs) {
- if (def.usage_mask & opt_set_mask && isprint8(def.short_option)) {
+ if (def.usage_mask & opt_set_mask && def.HasShortOption()) {
if (def.required && def.option_has_arg != OptionParser::eNoArgument)
PrintOption(def, eDisplayBestOption, " ", nullptr, true, strm);
}
@@ -579,7 +577,7 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
arg_name_str.Printf("<%s>", CommandObject::GetArgumentName(arg_type));
strm.Indent();
- if (opt_defs[i].short_option && isprint8(opt_defs[i].short_option)) {
+ if (opt_defs[i].short_option && opt_defs[i].HasShortOption()) {
PrintOption(opt_defs[i], eDisplayShortOption, nullptr, nullptr, false,
strm);
PrintOption(opt_defs[i], eDisplayLongOption, " ( ", " )", false, strm);
@@ -1308,7 +1306,7 @@ llvm::Expected<Args> Options::Parse(const Args &args,
&long_options_index);
if (val == ':') {
- error.SetErrorStringWithFormat("last option requires an argument");
+ error.SetErrorString("last option requires an argument");
break;
}
@@ -1317,7 +1315,7 @@ llvm::Expected<Args> Options::Parse(const Args &args,
// Did we get an error?
if (val == '?') {
- error.SetErrorStringWithFormat("unknown or ambiguous option");
+ error.SetErrorString("unknown or ambiguous option");
break;
}
// The option auto-set itself