1 //===-- OptionValueArch.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/OptionValueArch.h"
14 // Other libraries and framework includes
16 #include "lldb/Core/State.h"
17 #include "lldb/DataFormatters/FormatManager.h"
18 #include "lldb/Interpreter/Args.h"
19 #include "lldb/Interpreter/CommandCompletions.h"
22 using namespace lldb_private;
25 OptionValueArch::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
27 if (dump_mask & eDumpOptionType)
28 strm.Printf ("(%s)", GetTypeAsCString ());
29 if (dump_mask & eDumpOptionValue)
31 if (dump_mask & eDumpOptionType)
32 strm.PutCString (" = ");
34 if (m_current_value.IsValid())
36 const char *arch_name = m_current_value.GetArchitectureName();
38 strm.PutCString (arch_name);
44 OptionValueArch::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
49 case eVarSetOperationClear:
54 case eVarSetOperationReplace:
55 case eVarSetOperationAssign:
57 std::string value_str = value.trim().str();
58 if (m_current_value.SetTriple (value_str.c_str()))
60 m_value_was_set = true;
64 error.SetErrorStringWithFormat("unsupported architecture '%s'", value_str.c_str());
67 case eVarSetOperationInsertBefore:
68 case eVarSetOperationInsertAfter:
69 case eVarSetOperationRemove:
70 case eVarSetOperationAppend:
71 case eVarSetOperationInvalid:
72 error = OptionValue::SetValueFromString (value, op);
79 OptionValueArch::DeepCopy () const
81 return OptionValueSP(new OptionValueArch(*this));
86 OptionValueArch::AutoComplete (CommandInterpreter &interpreter,
88 int match_start_point,
89 int max_return_elements,
93 word_complete = false;
95 CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
96 CommandCompletions::eArchitectureCompletion,
103 return matches.GetSize();