]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUUID.cpp
Merge lldb trunk r366426, resolve conflicts, and update FREEBSD-Xlist.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Interpreter / OptionGroupUUID.cpp
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     error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
44     break;
45   }
46
47   return error;
48 }
49
50 void OptionGroupUUID::OptionParsingStarting(
51     ExecutionContext *execution_context) {
52   m_uuid.Clear();
53 }