]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUUID.cpp
Upgrade Unbound to 1.6.1. More to follow.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Interpreter / OptionGroupUUID.cpp
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/Host/OptionParser.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 llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() {
31   return llvm::makeArrayRef(g_option_table);
32 }
33
34 Status OptionGroupUUID::SetOptionValue(uint32_t option_idx,
35                                        llvm::StringRef option_arg,
36                                        ExecutionContext *execution_context) {
37   Status error;
38   const int short_option = g_option_table[option_idx].short_option;
39
40   switch (short_option) {
41   case 'u':
42     error = m_uuid.SetValueFromString(option_arg);
43     if (error.Success())
44       m_uuid.SetOptionWasSet();
45     break;
46
47   default:
48     error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
49     break;
50   }
51
52   return error;
53 }
54
55 void OptionGroupUUID::OptionParsingStarting(
56     ExecutionContext *execution_context) {
57   m_uuid.Clear();
58 }