/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 ¤t_value, |
27 | | const FileSpec &default_value, bool resolve = true); |
28 | | |
29 | 112k | ~OptionValueFileSpec() override = default; |
30 | | |
31 | | // Virtual subclass pure virtual overrides |
32 | | |
33 | 81.7k | 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 | 13 | llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override { |
39 | 13 | return m_current_value.GetPath(); |
40 | 13 | } |
41 | | |
42 | | Status |
43 | | SetValueFromString(llvm::StringRef value, |
44 | | VarSetOperationType op = eVarSetOperationAssign) override; |
45 | | |
46 | 40.9k | void Clear() override { |
47 | 40.9k | m_current_value = m_default_value; |
48 | 40.9k | m_value_was_set = false; |
49 | 40.9k | m_data_sp.reset(); |
50 | 40.9k | m_data_mod_time = llvm::sys::TimePoint<>(); |
51 | 40.9k | } |
52 | | |
53 | | void AutoComplete(CommandInterpreter &interpreter, |
54 | | CompletionRequest &request) override; |
55 | | |
56 | | // Subclass specific functions |
57 | | |
58 | 2.89k | FileSpec &GetCurrentValue() { return m_current_value; } |
59 | | |
60 | 58.5k | const FileSpec &GetCurrentValue() const { return m_current_value; } |
61 | | |
62 | 0 | const FileSpec &GetDefaultValue() const { return m_default_value; } |
63 | | |
64 | 11.8k | void SetCurrentValue(const FileSpec &value, bool set_value_was_set) { |
65 | 11.8k | m_current_value = value; |
66 | 11.8k | if (set_value_was_set) |
67 | 0 | m_value_was_set = true; |
68 | 11.8k | m_data_sp.reset(); |
69 | 11.8k | } |
70 | | |
71 | 3.91k | void SetDefaultValue(const FileSpec &value) { m_default_value = value; } |
72 | | |
73 | | const lldb::DataBufferSP &GetFileContents(); |
74 | | |
75 | 0 | void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; } |
76 | | |
77 | | protected: |
78 | | FileSpec m_current_value; |
79 | | FileSpec m_default_value; |
80 | | lldb::DataBufferSP m_data_sp; |
81 | | llvm::sys::TimePoint<> m_data_mod_time; |
82 | | uint32_t m_completion_mask = lldb::eDiskFileCompletion; |
83 | | bool m_resolve; |
84 | | }; |
85 | | |
86 | | } // namespace lldb_private |
87 | | |
88 | | #endif // LLDB_INTERPRETER_OPTIONVALUEFILESPEC_H |