1 //===-- OptionGroupArchitecture.cpp ---------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Interpreter/OptionGroupArchitecture.h"
10 #include "lldb/Host/OptionParser.h"
11 #include "lldb/Target/Platform.h"
14 using namespace lldb_private
;
16 static constexpr OptionDefinition g_option_table
[] = {
17 {LLDB_OPT_SET_1
, false, "arch", 'a', OptionParser::eRequiredArgument
,
18 nullptr, {}, 0, eArgTypeArchitecture
,
19 "Specify the architecture for the target."},
22 llvm::ArrayRef
<OptionDefinition
> OptionGroupArchitecture::GetDefinitions() {
23 return llvm::ArrayRef(g_option_table
);
26 bool OptionGroupArchitecture::GetArchitecture(Platform
*platform
,
28 arch
= Platform::GetAugmentedArchSpec(platform
, m_arch_str
);
29 return arch
.IsValid();
33 OptionGroupArchitecture::SetOptionValue(uint32_t option_idx
,
34 llvm::StringRef option_arg
,
35 ExecutionContext
*execution_context
) {
37 const int short_option
= g_option_table
[option_idx
].short_option
;
39 switch (short_option
) {
41 m_arch_str
.assign(std::string(option_arg
));
45 llvm_unreachable("Unimplemented option");
51 void OptionGroupArchitecture::OptionParsingStarting(
52 ExecutionContext
*execution_context
) {