1 //===-- OptionGroupArchitecture.cpp -----------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Interpreter/OptionGroupArchitecture.h"
14 // Other libraries and framework includes
16 #include "lldb/Utility/Utils.h"
19 using namespace lldb_private;
21 OptionGroupArchitecture::OptionGroupArchitecture() :
26 OptionGroupArchitecture::~OptionGroupArchitecture ()
30 static OptionDefinition
33 { LLDB_OPT_SET_1 , false, "arch" , 'a', required_argument, NULL, 0, eArgTypeArchitecture , "Specify the architecture for the target."},
37 OptionGroupArchitecture::GetNumDefinitions ()
39 return llvm::array_lengthof(g_option_table);
42 const OptionDefinition *
43 OptionGroupArchitecture::GetDefinitions ()
45 return g_option_table;
49 OptionGroupArchitecture::GetArchitecture (Platform *platform, ArchSpec &arch)
51 if (m_arch_str.empty())
54 arch.SetTriple(m_arch_str.c_str(), platform);
55 return arch.IsValid();
60 OptionGroupArchitecture::SetOptionValue (CommandInterpreter &interpreter,
62 const char *option_arg)
65 const int short_option = g_option_table[option_idx].short_option;
70 m_arch_str.assign (option_arg);
74 error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
82 OptionGroupArchitecture::OptionParsingStarting (CommandInterpreter &interpreter)