2020-01-24 08:23:27 +01:00
|
|
|
//===-- OptionGroupUUID.cpp -----------------------------------------------===//
|
2011-05-03 22:09:39 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2011-05-03 22:09:39 +00:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
2011-05-13 20:21:08 +00:00
|
|
|
#include "lldb/Interpreter/OptionGroupUUID.h"
|
2011-05-03 22:09:39 +00:00
|
|
|
|
2017-03-22 23:33:16 +00:00
|
|
|
#include "lldb/Host/OptionParser.h"
|
2011-05-03 22:09:39 +00:00
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
|
|
OptionGroupUUID::OptionGroupUUID() : m_uuid() {}
|
|
|
|
|
|
|
|
|
|
OptionGroupUUID::~OptionGroupUUID() {}
|
|
|
|
|
|
2018-09-26 18:50:19 +00:00
|
|
|
static constexpr OptionDefinition g_option_table[] = {
|
2014-07-09 16:31:49 +00:00
|
|
|
{LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument,
|
2020-08-11 12:29:25 +02:00
|
|
|
nullptr, {}, 0, eArgTypeModuleUUID, "A module UUID value."},
|
2011-05-03 22:09:39 +00:00
|
|
|
};
|
|
|
|
|
|
2016-09-22 20:22:55 +00:00
|
|
|
llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() {
|
2016-09-22 21:06:13 +00:00
|
|
|
return llvm::makeArrayRef(g_option_table);
|
2011-05-03 22:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
2017-05-12 04:51:55 +00:00
|
|
|
Status OptionGroupUUID::SetOptionValue(uint32_t option_idx,
|
|
|
|
|
llvm::StringRef option_arg,
|
|
|
|
|
ExecutionContext *execution_context) {
|
|
|
|
|
Status error;
|
2012-12-04 00:32:51 +00:00
|
|
|
const int short_option = g_option_table[option_idx].short_option;
|
2011-05-03 22:09:39 +00:00
|
|
|
|
|
|
|
|
switch (short_option) {
|
|
|
|
|
case 'u':
|
2015-02-20 11:14:59 +00:00
|
|
|
error = m_uuid.SetValueFromString(option_arg);
|
2011-09-30 01:05:23 +00:00
|
|
|
if (error.Success())
|
|
|
|
|
m_uuid.SetOptionWasSet();
|
2011-05-03 22:09:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2019-08-22 08:08:05 +00:00
|
|
|
llvm_unreachable("Unimplemented option");
|
2011-05-03 22:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-11 23:51:28 +00:00
|
|
|
void OptionGroupUUID::OptionParsingStarting(
|
|
|
|
|
ExecutionContext *execution_context) {
|
2011-05-03 22:09:39 +00:00
|
|
|
m_uuid.Clear();
|
|
|
|
|
}
|