LLDB mainline
OptionValueArch.h
Go to the documentation of this file.
1//===-- OptionValueArch.h -----------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_INTERPRETER_OPTIONVALUEARCH_H
10#define LLDB_INTERPRETER_OPTIONVALUEARCH_H
11
15#include <mutex>
16
17namespace lldb_private {
18
19class OptionValueArch : public Cloneable<OptionValueArch, OptionValue> {
20public:
21 OptionValueArch() = default;
22
23 OptionValueArch(const char *triple) : m_current_value(triple) {
25 }
26
28 : m_current_value(value), m_default_value(value) {}
29
30 OptionValueArch(const ArchSpec &current_value, const ArchSpec &default_value)
31 : m_current_value(current_value), m_default_value(default_value) {}
32
33 ~OptionValueArch() override = default;
34
35 // Virtual subclass pure virtual overrides
36
37 OptionValue::Type GetType() const override { return eTypeArch; }
38
39 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
40 uint32_t dump_mask) override;
41
42 llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override;
43
44 Status
45 SetValueFromString(llvm::StringRef value,
47
48 bool IsDefault() const override { return m_current_value == m_default_value; }
49
50 void AutoComplete(CommandInterpreter &interpreter,
51 lldb_private::CompletionRequest &request) override;
52
53 // Subclass specific functions
54
56
57 const ArchSpec &GetCurrentValue() const { return m_current_value; }
58
59 const ArchSpec &GetDefaultValue() const { return m_default_value; }
60
61 void SetCurrentValue(const ArchSpec &value, bool set_value_was_set) {
62 m_current_value = value;
63 if (set_value_was_set)
64 m_value_was_set = true;
65 }
66
67 void SetDefaultValue(const ArchSpec &value) { m_default_value = value; }
68
69protected:
70 void ClearImpl() override {
72 m_value_was_set = false;
73 }
74
77};
78
79} // namespace lldb_private
80
81#endif // LLDB_INTERPRETER_OPTIONVALUEARCH_H
An architecture specification class.
Definition ArchSpec.h:32
A class that implements CRTP-based "virtual constructor" idiom.
Definition Cloneable.h:40
"lldb/Utility/ArgCompletionRequest.h"
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
OptionValueArch(const char *triple)
const ArchSpec & GetDefaultValue() const
void SetCurrentValue(const ArchSpec &value, bool set_value_was_set)
void AutoComplete(CommandInterpreter &interpreter, lldb_private::CompletionRequest &request) override
const ArchSpec & GetCurrentValue() const
bool IsDefault() const override
Return true if the current value equals the default value.
OptionValueArch(const ArchSpec &current_value, const ArchSpec &default_value)
void SetDefaultValue(const ArchSpec &value)
~OptionValueArch() override=default
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override
OptionValue::Type GetType() const override
OptionValueArch(const ArchSpec &value)
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
A class that represents a running process on the host machine.
VarSetOperationType
Settable state variable types.