Coverage Report

Created: 2022-01-18 06:27

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Interpreter/OptionValueFileSpec.h
Line
Count
Source (jump to first uncovered line)
1
//===-- OptionValueFileSpec.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_OPTIONVALUEFILESPEC_H
10
#define LLDB_INTERPRETER_OPTIONVALUEFILESPEC_H
11
12
#include "lldb/Interpreter/CommandCompletions.h"
13
#include "lldb/Interpreter/OptionValue.h"
14
15
#include "lldb/Utility/FileSpec.h"
16
#include "llvm/Support/Chrono.h"
17
18
namespace lldb_private {
19
20
class OptionValueFileSpec : public Cloneable<OptionValueFileSpec, OptionValue> {
21
public:
22
  OptionValueFileSpec(bool resolve = true);
23
24
  OptionValueFileSpec(const FileSpec &value, bool resolve = true);
25
26
  OptionValueFileSpec(const FileSpec &current_value,
27
                      const FileSpec &default_value, bool resolve = true);
28
29
102k
  ~OptionValueFileSpec() override = default;
30
31
  // Virtual subclass pure virtual overrides
32
33
80.4k
  OptionValue::Type GetType() const override { return eTypeFileSpec; }
34
35
  void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
36
                 uint32_t dump_mask) override;
37
38
  Status
39
  SetValueFromString(llvm::StringRef value,
40
                     VarSetOperationType op = eVarSetOperationAssign) override;
41
42
40.9k
  void Clear() override {
43
40.9k
    m_current_value = m_default_value;
44
40.9k
    m_value_was_set = false;
45
40.9k
    m_data_sp.reset();
46
40.9k
    m_data_mod_time = llvm::sys::TimePoint<>();
47
40.9k
  }
48
49
  void AutoComplete(CommandInterpreter &interpreter,
50
                    CompletionRequest &request) override;
51
52
  // Subclass specific functions
53
54
5.66k
  FileSpec &GetCurrentValue() { return m_current_value; }
55
56
55.0k
  const FileSpec &GetCurrentValue() const { return m_current_value; }
57
58
0
  const FileSpec &GetDefaultValue() const { return m_default_value; }
59
60
10.2k
  void SetCurrentValue(const FileSpec &value, bool set_value_was_set) {
61
10.2k
    m_current_value = value;
62
10.2k
    if (set_value_was_set)
63
0
      m_value_was_set = true;
64
10.2k
    m_data_sp.reset();
65
10.2k
  }
66
67
3.40k
  void SetDefaultValue(const FileSpec &value) { m_default_value = value; }
68
69
  const lldb::DataBufferSP &GetFileContents();
70
71
0
  void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; }
72
73
protected:
74
  FileSpec m_current_value;
75
  FileSpec m_default_value;
76
  lldb::DataBufferSP m_data_sp;
77
  llvm::sys::TimePoint<> m_data_mod_time;
78
  uint32_t m_completion_mask = CommandCompletions::eDiskFileCompletion;
79
  bool m_resolve;
80
};
81
82
} // namespace lldb_private
83
84
#endif // LLDB_INTERPRETER_OPTIONVALUEFILESPEC_H