1 //===-- OptionGroupUUID.cpp -----------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "lldb/Interpreter/OptionGroupUUID.h" 10 11 #include "lldb/Host/OptionParser.h" 12 13 using namespace lldb; 14 using namespace lldb_private; 15 16 static constexpr OptionDefinition g_option_table[] = { 17 {LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument, 18 nullptr, {}, 0, eArgTypeModuleUUID, "A module UUID value."}, 19 }; 20 21 llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() { 22 return llvm::ArrayRef(g_option_table); 23 } 24 25 Status OptionGroupUUID::SetOptionValue(uint32_t option_idx, 26 llvm::StringRef option_arg, 27 ExecutionContext *execution_context) { 28 Status error; 29 const int short_option = g_option_table[option_idx].short_option; 30 31 switch (short_option) { 32 case 'u': 33 error = m_uuid.SetValueFromString(option_arg); 34 if (error.Success()) 35 m_uuid.SetOptionWasSet(); 36 break; 37 38 default: 39 llvm_unreachable("Unimplemented option"); 40 } 41 42 return error; 43 } 44 45 void OptionGroupUUID::OptionParsingStarting( 46 ExecutionContext *execution_context) { 47 m_uuid.Clear(); 48 } 49