LLDB  mainline
OptionGroupUUID.cpp
Go to the documentation of this file.
1 //===-- OptionGroupUUID.cpp -----------------------------------------------===//
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 
10 
11 #include "lldb/Host/OptionParser.h"
12 
13 using namespace lldb;
14 using namespace lldb_private;
15 
16 static constexpr OptionDefinition g_option_table[] = {
17  {LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument,
18  nullptr, {}, 0, eArgTypeModuleUUID, "A module UUID value."},
19 };
20 
21 llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() {
22  return llvm::makeArrayRef(g_option_table);
23 }
24 
25 Status OptionGroupUUID::SetOptionValue(uint32_t option_idx,
26  llvm::StringRef option_arg,
27  ExecutionContext *execution_context) {
28  Status error;
29  const int short_option = g_option_table[option_idx].short_option;
30 
31  switch (short_option) {
32  case 'u':
33  error = m_uuid.SetValueFromString(option_arg);
34  if (error.Success())
35  m_uuid.SetOptionWasSet();
36  break;
37 
38  default:
39  llvm_unreachable("Unimplemented option");
40  }
41 
42  return error;
43 }
44 
45 void OptionGroupUUID::OptionParsingStarting(
46  ExecutionContext *execution_context) {
47  m_uuid.Clear();
48 }
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
g_option_table
static constexpr OptionDefinition g_option_table[]
Definition: OptionGroupUUID.cpp:16
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
OptionGroupUUID.h
LLDB_OPT_SET_1
#define LLDB_OPT_SET_1
Definition: lldb-defines.h:113
lldb_private::Status
Definition: Status.h:44
uint32_t
lldb::eArgTypeModuleUUID
@ eArgTypeModuleUUID
Definition: lldb-enumerations.h:603
OptionParser.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::OptionDefinition
Definition: OptionDefinition.h:20
lldb_private::OptionDefinition::short_option
int short_option
Single character for this option.
Definition: OptionDefinition.h:32
lldb
Definition: SBAddress.h:15