Coverage Report

Created: 2023-09-12 09:32

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Interpreter/OptionValueArch.h
Line
Count
Source (jump to first uncovered line)
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
12
#include "lldb/Interpreter/OptionValue.h"
13
#include "lldb/Utility/ArchSpec.h"
14
#include "lldb/Utility/CompletionRequest.h"
15
16
namespace lldb_private {
17
18
class OptionValueArch : public Cloneable<OptionValueArch, OptionValue> {
19
public:
20
0
  OptionValueArch() = default;
21
22
3.90k
  OptionValueArch(const char *triple) : m_current_value(triple) {
23
3.90k
    m_default_value = m_current_value;
24
3.90k
  }
25
26
  OptionValueArch(const ArchSpec &value)
27
0
      : m_current_value(value), m_default_value(value) {}
28
29
  OptionValueArch(const ArchSpec &current_value, const ArchSpec &default_value)
30
0
      : m_current_value(current_value), m_default_value(default_value) {}
31
32
0
  ~OptionValueArch() override = default;
33
34
  // Virtual subclass pure virtual overrides
35
36
6.29k
  OptionValue::Type GetType() const override { return eTypeArch; }
37
38
  void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
39
                 uint32_t dump_mask) override;
40
41
  Status
42
  SetValueFromString(llvm::StringRef value,
43
                     VarSetOperationType op = eVarSetOperationAssign) override;
44
45
3.13k
  void Clear() override {
46
3.13k
    m_current_value = m_default_value;
47
3.13k
    m_value_was_set = false;
48
3.13k
  }
49
50
  void AutoComplete(CommandInterpreter &interpreter,
51
                    lldb_private::CompletionRequest &request) override;
52
53
  // Subclass specific functions
54
55
0
  ArchSpec &GetCurrentValue() { return m_current_value; }
56
57
6.26k
  const ArchSpec &GetCurrentValue() const { return m_current_value; }
58
59
0
  const ArchSpec &GetDefaultValue() const { return m_default_value; }
60
61
4
  void SetCurrentValue(const ArchSpec &value, bool set_value_was_set) {
62
4
    m_current_value = value;
63
4
    if (set_value_was_set)
64
0
      m_value_was_set = true;
65
4
  }
66
67
0
  void SetDefaultValue(const ArchSpec &value) { m_default_value = value; }
68
69
protected:
70
  ArchSpec m_current_value;
71
  ArchSpec m_default_value;
72
};
73
74
} // namespace lldb_private
75
76
#endif // LLDB_INTERPRETER_OPTIONVALUEARCH_H