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