1 //===-- OptionGroupUUID.cpp -------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "lldb/Interpreter/OptionGroupUUID.h" 11 12 // C Includes 13 // C++ Includes 14 // Other libraries and framework includes 15 // Project includes 16 #include "lldb/Utility/Utils.h" 17 18 using namespace lldb; 19 using namespace lldb_private; 20 21 OptionGroupUUID::OptionGroupUUID() : m_uuid() {} 22 23 OptionGroupUUID::~OptionGroupUUID() {} 24 25 static OptionDefinition g_option_table[] = { 26 {LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument, 27 nullptr, nullptr, 0, eArgTypeNone, "A module UUID value."}, 28 }; 29 30 uint32_t OptionGroupUUID::GetNumDefinitions() { 31 return llvm::array_lengthof(g_option_table); 32 } 33 34 const OptionDefinition *OptionGroupUUID::GetDefinitions() { 35 return g_option_table; 36 } 37 38 Error OptionGroupUUID::SetOptionValue(uint32_t option_idx, 39 const char *option_arg, 40 ExecutionContext *execution_context) { 41 Error error; 42 const int short_option = g_option_table[option_idx].short_option; 43 44 switch (short_option) { 45 case 'u': 46 error = m_uuid.SetValueFromString(option_arg); 47 if (error.Success()) 48 m_uuid.SetOptionWasSet(); 49 break; 50 51 default: 52 error.SetErrorStringWithFormat("unrecognized option '%c'", short_option); 53 break; 54 } 55 56 return error; 57 } 58 59 void OptionGroupUUID::OptionParsingStarting( 60 ExecutionContext *execution_context) { 61 m_uuid.Clear(); 62 } 63