Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override { Error error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { case 'r': reg = ConstString(option_arg); break; case 'a': { address.emplace(); if (option_arg.getAsInteger(0, *address)) { address.reset(); error.SetErrorStringWithFormat("invalid address argument '%s'", option_arg.str().c_str()); } } break; case 'o': { offset.emplace(); if (option_arg.getAsInteger(0, *offset)) { offset.reset(); error.SetErrorStringWithFormat("invalid offset argument '%s'", option_arg.str().c_str()); } } break; default: error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } return error; }
bool parse(cl::Option &O, llvm::StringRef /*ArgName*/, llvm::StringRef Arg, unsigned char &Val) { if (Arg == "") { Val = 0; return false; } if (Arg.getAsInteger(0, Val)) { return O.error("'" + Arg + "' value invalid for required coverage percentage"); } if (Val > 100) { return O.error("Required coverage percentage must be <= 100"); } return false; }
Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override { Error error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { case 'r': if (option_arg.getAsInteger(0, relative_frame_offset)) { relative_frame_offset = INT32_MIN; error.SetErrorStringWithFormat("invalid frame offset argument '%s'", option_arg.str().c_str()); } break; default: error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } return error; }
Status OptionGroupValueObjectDisplay::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { Status error; const int short_option = g_option_table[option_idx].short_option; bool success = false; switch (short_option) { case 'd': { int32_t result; result = Args::StringToOptionEnum(option_arg, g_dynamic_value_types, 2, error); if (error.Success()) use_dynamic = (lldb::DynamicValueType)result; } break; case 'T': show_types = true; break; case 'L': show_location = true; break; case 'F': flat_output = true; break; case 'O': use_objc = true; break; case 'R': be_raw = true; break; case 'A': ignore_cap = true; break; case 'D': if (option_arg.getAsInteger(0, max_depth)) { max_depth = UINT32_MAX; error.SetErrorStringWithFormat("invalid max depth '%s'", option_arg.str().c_str()); } break; case 'Z': if (option_arg.getAsInteger(0, elem_count)) { elem_count = UINT32_MAX; error.SetErrorStringWithFormat("invalid element count '%s'", option_arg.str().c_str()); } break; case 'P': if (option_arg.getAsInteger(0, ptr_depth)) { ptr_depth = 0; error.SetErrorStringWithFormat("invalid pointer depth '%s'", option_arg.str().c_str()); } break; case 'Y': if (option_arg.empty()) no_summary_depth = 1; else if (option_arg.getAsInteger(0, no_summary_depth)) { no_summary_depth = 0; error.SetErrorStringWithFormat("invalid pointer depth '%s'", option_arg.str().c_str()); } break; case 'S': use_synth = Args::StringToBoolean(option_arg, true, &success); if (!success) error.SetErrorStringWithFormat("invalid synthetic-type '%s'", option_arg.str().c_str()); break; case 'V': run_validator = Args::StringToBoolean(option_arg, true, &success); if (!success) error.SetErrorStringWithFormat("invalid validate '%s'", option_arg.str().c_str()); break; default: error.SetErrorStringWithFormat("unrecognized option '%c'", short_option); break; } return error; }