1cfca06d7SDimitry Andric //===-- OptionGroupUUID.cpp -----------------------------------------------===//
2f034231aSEd Maste //
35f29bb8aSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45f29bb8aSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
55f29bb8aSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6f034231aSEd Maste //
7f034231aSEd Maste //===----------------------------------------------------------------------===//
8f034231aSEd Maste
9f034231aSEd Maste #include "lldb/Interpreter/OptionGroupUUID.h"
10f034231aSEd Maste
1174a628f7SDimitry Andric #include "lldb/Host/OptionParser.h"
12f034231aSEd Maste
13f034231aSEd Maste using namespace lldb;
14f034231aSEd Maste using namespace lldb_private;
15f034231aSEd Maste
1694994d37SDimitry Andric static constexpr OptionDefinition g_option_table[] = {
1714f1b3e8SDimitry Andric {LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument,
18b60736ecSDimitry Andric nullptr, {}, 0, eArgTypeModuleUUID, "A module UUID value."},
19f034231aSEd Maste };
20f034231aSEd Maste
GetDefinitions()2114f1b3e8SDimitry Andric llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() {
22e3b55780SDimitry Andric return llvm::ArrayRef(g_option_table);
23f034231aSEd Maste }
24f034231aSEd Maste
SetOptionValue(uint32_t option_idx,llvm::StringRef option_arg,ExecutionContext * execution_context)25b76161e4SDimitry Andric Status OptionGroupUUID::SetOptionValue(uint32_t option_idx,
2614f1b3e8SDimitry Andric llvm::StringRef option_arg,
2714f1b3e8SDimitry Andric ExecutionContext *execution_context) {
28b76161e4SDimitry Andric Status error;
29f034231aSEd Maste const int short_option = g_option_table[option_idx].short_option;
30f034231aSEd Maste
3114f1b3e8SDimitry Andric switch (short_option) {
32f034231aSEd Maste case 'u':
335e95aa85SEd Maste error = m_uuid.SetValueFromString(option_arg);
34f034231aSEd Maste if (error.Success())
35f034231aSEd Maste m_uuid.SetOptionWasSet();
36f034231aSEd Maste break;
37f034231aSEd Maste
38f034231aSEd Maste default:
39ead24645SDimitry Andric llvm_unreachable("Unimplemented option");
40f034231aSEd Maste }
41f034231aSEd Maste
42f034231aSEd Maste return error;
43f034231aSEd Maste }
44f034231aSEd Maste
OptionParsingStarting(ExecutionContext * execution_context)4514f1b3e8SDimitry Andric void OptionGroupUUID::OptionParsingStarting(
4614f1b3e8SDimitry Andric ExecutionContext *execution_context) {
47f034231aSEd Maste m_uuid.Clear();
48f034231aSEd Maste }
49