[NFC][Coroutines] Use structured binding with llvm::enumerate in CoroSplit (#116879)
[llvm-project.git] / lldb / source / Interpreter / OptionGroupFile.cpp
blob12ade18558291b7770539e41cb5c26505ef2ef97
1 //===-- OptionGroupFile.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 //===----------------------------------------------------------------------===//
9 #include "lldb/Interpreter/OptionGroupFile.h"
11 #include "lldb/Host/OptionParser.h"
13 using namespace lldb;
14 using namespace lldb_private;
16 OptionGroupFile::OptionGroupFile(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 m_option_definition.usage_mask = usage_mask;
22 m_option_definition.required = required;
23 m_option_definition.long_option = long_option;
24 m_option_definition.short_option = short_option;
25 m_option_definition.validator = nullptr;
26 m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
27 m_option_definition.enum_values = {};
28 m_option_definition.completion_type = completion_type;
29 m_option_definition.argument_type = argument_type;
30 m_option_definition.usage_text = usage_text;
33 Status OptionGroupFile::SetOptionValue(uint32_t option_idx,
34 llvm::StringRef option_arg,
35 ExecutionContext *execution_context) {
36 Status error(m_file.SetValueFromString(option_arg));
37 return error;
40 void OptionGroupFile::OptionParsingStarting(
41 ExecutionContext *execution_context) {
42 m_file.Clear();
45 OptionGroupFileList::OptionGroupFileList(
46 uint32_t usage_mask, bool required, const char *long_option,
47 int short_option, uint32_t completion_type,
48 lldb::CommandArgumentType argument_type, const char *usage_text)
49 : m_file_list() {
50 m_option_definition.usage_mask = usage_mask;
51 m_option_definition.required = required;
52 m_option_definition.long_option = long_option;
53 m_option_definition.short_option = short_option;
54 m_option_definition.validator = nullptr;
55 m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
56 m_option_definition.enum_values = {};
57 m_option_definition.completion_type = completion_type;
58 m_option_definition.argument_type = argument_type;
59 m_option_definition.usage_text = usage_text;
62 OptionGroupFileList::~OptionGroupFileList() = default;
64 Status
65 OptionGroupFileList::SetOptionValue(uint32_t option_idx,
66 llvm::StringRef option_value,
67 ExecutionContext *execution_context) {
68 Status error(m_file_list.SetValueFromString(option_value));
69 return error;
72 void OptionGroupFileList::OptionParsingStarting(
73 ExecutionContext *execution_context) {
74 m_file_list.Clear();