| 1 | //===-- OptionGroupUInt64.cpp ---------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "lldb/Interpreter/OptionGroupUInt64.h" |
| 10 | |
| 11 | #include "lldb/Host/OptionParser.h" |
| 12 | |
| 13 | using namespace lldb; |
| 14 | using namespace lldb_private; |
| 15 | |
| 16 | OptionGroupUInt64::OptionGroupUInt64(uint32_t usage_mask, bool required, |
| 17 | const char *long_option, int short_option, |
| 18 | uint32_t completion_type, |
| 19 | lldb::CommandArgumentType argument_type, |
| 20 | const char *usage_text, |
| 21 | uint64_t default_value) |
| 22 | : m_value(default_value, default_value) { |
| 23 | m_option_definition.usage_mask = usage_mask; |
| 24 | m_option_definition.required = required; |
| 25 | m_option_definition.long_option = long_option; |
| 26 | m_option_definition.short_option = short_option; |
| 27 | m_option_definition.validator = nullptr; |
| 28 | m_option_definition.option_has_arg = OptionParser::eRequiredArgument; |
| 29 | m_option_definition.enum_values = {}; |
| 30 | m_option_definition.completion_type = completion_type; |
| 31 | m_option_definition.argument_type = argument_type; |
| 32 | m_option_definition.usage_text = usage_text; |
| 33 | } |
| 34 | |
| 35 | Status OptionGroupUInt64::SetOptionValue(uint32_t option_idx, |
| 36 | llvm::StringRef option_arg, |
| 37 | ExecutionContext *execution_context) { |
| 38 | Status error(m_value.SetValueFromString(value: option_arg)); |
| 39 | return error; |
| 40 | } |
| 41 | |
| 42 | void OptionGroupUInt64::OptionParsingStarting( |
| 43 | ExecutionContext *execution_context) { |
| 44 | m_value.Clear(); |
| 45 | } |
| 46 | |