OptionGroupUUID.cpp revision 360784
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 13using namespace lldb; 14using namespace lldb_private; 15 16OptionGroupUUID::OptionGroupUUID() : m_uuid() {} 17 18OptionGroupUUID::~OptionGroupUUID() {} 19 20static 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 25llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() { 26 return llvm::makeArrayRef(g_option_table); 27} 28 29Status 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 49void OptionGroupUUID::OptionParsingStarting( 50 ExecutionContext *execution_context) { 51 m_uuid.Clear(); 52} 53