]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueArch.h
Import DTS files from Linux 4.18
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / OptionValueArch.h
1 //===-- OptionValueArch.h -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_OptionValueArch_h_
11 #define liblldb_OptionValueArch_h_
12
13 #include "lldb/Interpreter/OptionValue.h"
14 #include "lldb/Utility/ArchSpec.h"
15
16 namespace lldb_private {
17
18 class OptionValueArch : public OptionValue {
19 public:
20   OptionValueArch() : OptionValue(), m_current_value(), m_default_value() {}
21
22   OptionValueArch(const char *triple)
23       : OptionValue(), m_current_value(triple), m_default_value() {
24     m_default_value = m_current_value;
25   }
26
27   OptionValueArch(const ArchSpec &value)
28       : OptionValue(), m_current_value(value), m_default_value(value) {}
29
30   OptionValueArch(const ArchSpec &current_value, const ArchSpec &default_value)
31       : OptionValue(), m_current_value(current_value),
32         m_default_value(default_value) {}
33
34   ~OptionValueArch() override {}
35
36   //---------------------------------------------------------------------
37   // Virtual subclass pure virtual overrides
38   //---------------------------------------------------------------------
39
40   OptionValue::Type GetType() const override { return eTypeArch; }
41
42   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
43                  uint32_t dump_mask) override;
44
45   Status
46   SetValueFromString(llvm::StringRef value,
47                      VarSetOperationType op = eVarSetOperationAssign) override;
48   Status
49   SetValueFromString(const char *,
50                      VarSetOperationType = eVarSetOperationAssign) = delete;
51
52   bool Clear() override {
53     m_current_value = m_default_value;
54     m_value_was_set = false;
55     return true;
56   }
57
58   lldb::OptionValueSP DeepCopy() const override;
59
60   size_t AutoComplete(CommandInterpreter &interpreter, llvm::StringRef s,
61                       int match_start_point, int max_return_elements,
62                       bool &word_complete, StringList &matches) override;
63
64   //---------------------------------------------------------------------
65   // Subclass specific functions
66   //---------------------------------------------------------------------
67
68   ArchSpec &GetCurrentValue() { return m_current_value; }
69
70   const ArchSpec &GetCurrentValue() const { return m_current_value; }
71
72   const ArchSpec &GetDefaultValue() const { return m_default_value; }
73
74   void SetCurrentValue(const ArchSpec &value, bool set_value_was_set) {
75     m_current_value = value;
76     if (set_value_was_set)
77       m_value_was_set = true;
78   }
79
80   void SetDefaultValue(const ArchSpec &value) { m_default_value = value; }
81
82 protected:
83   ArchSpec m_current_value;
84   ArchSpec m_default_value;
85 };
86
87 } // namespace lldb_private
88
89 #endif // liblldb_OptionValueArch_h_