180814287SRaphael Isemann //===-- OptionGroupUUID.cpp -----------------------------------------------===//
2effe5c95SGreg Clayton //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6effe5c95SGreg Clayton //
7effe5c95SGreg Clayton //===----------------------------------------------------------------------===//
8effe5c95SGreg Clayton
94bee32e5SJohnny Chen #include "lldb/Interpreter/OptionGroupUUID.h"
10effe5c95SGreg Clayton
113eb2b44dSZachary Turner #include "lldb/Host/OptionParser.h"
12effe5c95SGreg Clayton
13effe5c95SGreg Clayton using namespace lldb;
14effe5c95SGreg Clayton using namespace lldb_private;
15effe5c95SGreg Clayton
168fe53c49STatyana Krasnukha static constexpr OptionDefinition g_option_table[] = {
17b9c1b51eSKate Stone {LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument,
18*419f1be7SGongyu Deng nullptr, {}, 0, eArgTypeModuleUUID, "A module UUID value."},
19effe5c95SGreg Clayton };
20effe5c95SGreg Clayton
GetDefinitions()211f0f5b5bSZachary Turner llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() {
2270602439SZachary Turner return llvm::makeArrayRef(g_option_table);
23effe5c95SGreg Clayton }
24effe5c95SGreg Clayton
SetOptionValue(uint32_t option_idx,llvm::StringRef option_arg,ExecutionContext * execution_context)2597206d57SZachary Turner Status OptionGroupUUID::SetOptionValue(uint32_t option_idx,
268cef4b0bSZachary Turner llvm::StringRef option_arg,
27b9c1b51eSKate Stone ExecutionContext *execution_context) {
2897206d57SZachary Turner Status error;
293bcdfc0eSGreg Clayton const int short_option = g_option_table[option_idx].short_option;
30effe5c95SGreg Clayton
31b9c1b51eSKate Stone switch (short_option) {
32effe5c95SGreg Clayton case 'u':
33c95f7e2aSPavel Labath error = m_uuid.SetValueFromString(option_arg);
342af4db58SJim Ingham if (error.Success())
352af4db58SJim Ingham m_uuid.SetOptionWasSet();
36effe5c95SGreg Clayton break;
37effe5c95SGreg Clayton
38effe5c95SGreg Clayton default:
3936162014SRaphael Isemann llvm_unreachable("Unimplemented option");
40effe5c95SGreg Clayton }
41effe5c95SGreg Clayton
42effe5c95SGreg Clayton return error;
43effe5c95SGreg Clayton }
44effe5c95SGreg Clayton
OptionParsingStarting(ExecutionContext * execution_context)45b9c1b51eSKate Stone void OptionGroupUUID::OptionParsingStarting(
46b9c1b51eSKate Stone ExecutionContext *execution_context) {
47effe5c95SGreg Clayton m_uuid.Clear();
48effe5c95SGreg Clayton }
49