Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:50

0001 //===-- OptionValueArch.h -----------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_INTERPRETER_OPTIONVALUEARCH_H
0010 #define LLDB_INTERPRETER_OPTIONVALUEARCH_H
0011 
0012 #include "lldb/Interpreter/OptionValue.h"
0013 #include "lldb/Utility/ArchSpec.h"
0014 #include "lldb/Utility/CompletionRequest.h"
0015 
0016 namespace lldb_private {
0017 
0018 class OptionValueArch : public Cloneable<OptionValueArch, OptionValue> {
0019 public:
0020   OptionValueArch() = default;
0021 
0022   OptionValueArch(const char *triple) : m_current_value(triple) {
0023     m_default_value = m_current_value;
0024   }
0025 
0026   OptionValueArch(const ArchSpec &value)
0027       : m_current_value(value), m_default_value(value) {}
0028 
0029   OptionValueArch(const ArchSpec &current_value, const ArchSpec &default_value)
0030       : m_current_value(current_value), m_default_value(default_value) {}
0031 
0032   ~OptionValueArch() override = default;
0033 
0034   // Virtual subclass pure virtual overrides
0035 
0036   OptionValue::Type GetType() const override { return eTypeArch; }
0037 
0038   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
0039                  uint32_t dump_mask) override;
0040 
0041   Status
0042   SetValueFromString(llvm::StringRef value,
0043                      VarSetOperationType op = eVarSetOperationAssign) override;
0044 
0045   void Clear() override {
0046     m_current_value = m_default_value;
0047     m_value_was_set = false;
0048   }
0049 
0050   void AutoComplete(CommandInterpreter &interpreter,
0051                     lldb_private::CompletionRequest &request) override;
0052 
0053   // Subclass specific functions
0054 
0055   ArchSpec &GetCurrentValue() { return m_current_value; }
0056 
0057   const ArchSpec &GetCurrentValue() const { return m_current_value; }
0058 
0059   const ArchSpec &GetDefaultValue() const { return m_default_value; }
0060 
0061   void SetCurrentValue(const ArchSpec &value, bool set_value_was_set) {
0062     m_current_value = value;
0063     if (set_value_was_set)
0064       m_value_was_set = true;
0065   }
0066 
0067   void SetDefaultValue(const ArchSpec &value) { m_default_value = value; }
0068 
0069 protected:
0070   ArchSpec m_current_value;
0071   ArchSpec m_default_value;
0072 };
0073 
0074 } // namespace lldb_private
0075 
0076 #endif // LLDB_INTERPRETER_OPTIONVALUEARCH_H