1ac7ddfbfSEd Maste //===-- OptionGroupUUID.cpp -------------------------------------*- C++ -*-===//
2ac7ddfbfSEd Maste //
3ac7ddfbfSEd Maste //                     The LLVM Compiler Infrastructure
4ac7ddfbfSEd Maste //
5ac7ddfbfSEd Maste // This file is distributed under the University of Illinois Open Source
6ac7ddfbfSEd Maste // License. See LICENSE.TXT for details.
7ac7ddfbfSEd Maste //
8ac7ddfbfSEd Maste //===----------------------------------------------------------------------===//
9ac7ddfbfSEd Maste 
10ac7ddfbfSEd Maste #include "lldb/Interpreter/OptionGroupUUID.h"
11ac7ddfbfSEd Maste 
12f678e45dSDimitry Andric #include "lldb/Host/OptionParser.h"
13ac7ddfbfSEd Maste 
14ac7ddfbfSEd Maste using namespace lldb;
15ac7ddfbfSEd Maste using namespace lldb_private;
16ac7ddfbfSEd Maste 
OptionGroupUUID()17435933ddSDimitry Andric OptionGroupUUID::OptionGroupUUID() : m_uuid() {}
18ac7ddfbfSEd Maste 
~OptionGroupUUID()19435933ddSDimitry Andric OptionGroupUUID::~OptionGroupUUID() {}
20ac7ddfbfSEd Maste 
21*b5893f02SDimitry Andric static constexpr OptionDefinition g_option_table[] = {
22435933ddSDimitry Andric     {LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument,
23*b5893f02SDimitry Andric      nullptr, {}, 0, eArgTypeNone, "A module UUID value."},
24ac7ddfbfSEd Maste };
25ac7ddfbfSEd Maste 
GetDefinitions()26435933ddSDimitry Andric llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() {
27435933ddSDimitry Andric   return llvm::makeArrayRef(g_option_table);
28ac7ddfbfSEd Maste }
29ac7ddfbfSEd Maste 
SetOptionValue(uint32_t option_idx,llvm::StringRef option_arg,ExecutionContext * execution_context)305517e702SDimitry Andric Status OptionGroupUUID::SetOptionValue(uint32_t option_idx,
31435933ddSDimitry Andric                                        llvm::StringRef option_arg,
32435933ddSDimitry Andric                                        ExecutionContext *execution_context) {
335517e702SDimitry Andric   Status error;
34ac7ddfbfSEd Maste   const int short_option = g_option_table[option_idx].short_option;
35ac7ddfbfSEd Maste 
36435933ddSDimitry Andric   switch (short_option) {
37ac7ddfbfSEd Maste   case 'u':
381c3bbb01SEd Maste     error = m_uuid.SetValueFromString(option_arg);
39ac7ddfbfSEd Maste     if (error.Success())
40ac7ddfbfSEd Maste       m_uuid.SetOptionWasSet();
41ac7ddfbfSEd Maste     break;
42ac7ddfbfSEd Maste 
43ac7ddfbfSEd Maste   default:
44ac7ddfbfSEd Maste     error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
45ac7ddfbfSEd Maste     break;
46ac7ddfbfSEd Maste   }
47ac7ddfbfSEd Maste 
48ac7ddfbfSEd Maste   return error;
49ac7ddfbfSEd Maste }
50ac7ddfbfSEd Maste 
OptionParsingStarting(ExecutionContext * execution_context)51435933ddSDimitry Andric void OptionGroupUUID::OptionParsingStarting(
52435933ddSDimitry Andric     ExecutionContext *execution_context) {
53ac7ddfbfSEd Maste   m_uuid.Clear();
54ac7ddfbfSEd Maste }
55