Path: blob/main/contrib/llvm-project/lldb/source/Interpreter/OptionGroupArchitecture.cpp
39587 views
//===-- OptionGroupArchitecture.cpp ---------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/Interpreter/OptionGroupArchitecture.h"9#include "lldb/Host/OptionParser.h"10#include "lldb/Target/Platform.h"1112using namespace lldb;13using namespace lldb_private;1415static constexpr OptionDefinition g_option_table[] = {16{LLDB_OPT_SET_1, false, "arch", 'a', OptionParser::eRequiredArgument,17nullptr, {}, 0, eArgTypeArchitecture,18"Specify the architecture for the target."},19};2021llvm::ArrayRef<OptionDefinition> OptionGroupArchitecture::GetDefinitions() {22return llvm::ArrayRef(g_option_table);23}2425bool OptionGroupArchitecture::GetArchitecture(Platform *platform,26ArchSpec &arch) {27arch = Platform::GetAugmentedArchSpec(platform, m_arch_str);28return arch.IsValid();29}3031Status32OptionGroupArchitecture::SetOptionValue(uint32_t option_idx,33llvm::StringRef option_arg,34ExecutionContext *execution_context) {35Status error;36const int short_option = g_option_table[option_idx].short_option;3738switch (short_option) {39case 'a':40m_arch_str.assign(std::string(option_arg));41break;4243default:44llvm_unreachable("Unimplemented option");45}4647return error;48}4950void OptionGroupArchitecture::OptionParsingStarting(51ExecutionContext *execution_context) {52m_arch_str.clear();53}545556