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 17 using namespace lldb; 18 using namespace lldb_private; 19 20 OptionGroupUUID::OptionGroupUUID() : m_uuid() {} 21 22 OptionGroupUUID::~OptionGroupUUID() {} 23 24 static OptionDefinition g_option_table[] = { 25 {LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument, 26 nullptr, nullptr, 0, eArgTypeNone, "A module UUID value."}, 27 }; 28 29 llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() { 30 return llvm::makeArrayRef(g_option_table); 31 } 32 33 Error OptionGroupUUID::SetOptionValue(uint32_t option_idx, 34 llvm::StringRef option_arg, 35 ExecutionContext *execution_context) { 36 Error error; 37 const int short_option = g_option_table[option_idx].short_option; 38 39 switch (short_option) { 40 case 'u': 41 error = m_uuid.SetValueFromString(option_arg); 42 if (error.Success()) 43 m_uuid.SetOptionWasSet(); 44 break; 45 46 default: 47 error.SetErrorStringWithFormat("unrecognized option '%c'", short_option); 48 break; 49 } 50 51 return error; 52 } 53 54 void OptionGroupUUID::OptionParsingStarting( 55 ExecutionContext *execution_context) { 56 m_uuid.Clear(); 57 } 58