]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUUID.cpp
Update mandoc to 1.14.5
[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 #include "lldb/Host/OptionParser.h"
13
14 using namespace lldb;
15 using namespace lldb_private;
16
17 OptionGroupUUID::OptionGroupUUID() : m_uuid() {}
18
19 OptionGroupUUID::~OptionGroupUUID() {}
20
21 static constexpr OptionDefinition g_option_table[] = {
22     {LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument,
23      nullptr, {}, 0, eArgTypeNone, "A module UUID value."},
24 };
25
26 llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() {
27   return llvm::makeArrayRef(g_option_table);
28 }
29
30 Status OptionGroupUUID::SetOptionValue(uint32_t option_idx,
31                                        llvm::StringRef option_arg,
32                                        ExecutionContext *execution_context) {
33   Status error;
34   const int short_option = g_option_table[option_idx].short_option;
35
36   switch (short_option) {
37   case 'u':
38     error = m_uuid.SetValueFromString(option_arg);
39     if (error.Success())
40       m_uuid.SetOptionWasSet();
41     break;
42
43   default:
44     error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
45     break;
46   }
47
48   return error;
49 }
50
51 void OptionGroupUUID::OptionParsingStarting(
52     ExecutionContext *execution_context) {
53   m_uuid.Clear();
54 }