LLDB  mainline
OptionGroupUUID.cpp
Go to the documentation of this file.
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 
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  error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
44  break;
45  }
46 
47  return error;
48 }
49 
51  ExecutionContext *execution_context) {
52  m_uuid.Clear();
53 }
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
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.
void OptionParsingStarting(ExecutionContext *execution_context) override
bool Success() const
Test for success condition.
Definition: Status.cpp:287
Definition: SBAddress.h:15
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
Definition: Status.cpp:255
#define LLDB_OPT_SET_1
Definition: lldb-defines.h:111
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
An error handling class.
Definition: Status.h:44