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 OptionGroupUUID::OptionGroupUUID() : m_uuid() {}
17 
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 
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())
40  break;
41 
42  default:
43  llvm_unreachable("Unimplemented option");
44  }
45 
46  return error;
47 }
48 
50  ExecutionContext *execution_context) {
51  m_uuid.Clear();
52 }
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
A class that represents a running process on the host machine.
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
static constexpr OptionDefinition g_option_table[]
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
static llvm::raw_ostream & error(Stream &strm)
void OptionParsingStarting(ExecutionContext *execution_context) override
bool Success() const
Test for success condition.
Definition: Status.cpp:288
Definition: SBAddress.h:15
#define LLDB_OPT_SET_1
Definition: lldb-defines.h:111
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
An error handling class.
Definition: Status.h:44