LLDB mainline
OptionValueFileSpecList.h
Go to the documentation of this file.
1//===-- OptionValueFileSpecList.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_OPTIONVALUEFILESPECLIST_H
10#define LLDB_INTERPRETER_OPTIONVALUEFILESPECLIST_H
11
12#include <mutex>
13
16
17namespace lldb_private {
18
20 : public Cloneable<OptionValueFileSpecList, OptionValue> {
21public:
23
26
27 ~OptionValueFileSpecList() override = default;
28
29 // Virtual subclass pure virtual overrides
30
31 OptionValue::Type GetType() const override { return eTypeFileSpecList; }
32
33 void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
34 uint32_t dump_mask) override;
35
36 llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override;
37
38 Status
39 SetValueFromString(llvm::StringRef value,
41
42 bool IsAggregateValue() const override { return true; }
43
44 // Subclass specific functions
45
47 std::lock_guard<std::recursive_mutex> lock(m_rmutex);
48 return m_current_value;
49 }
50
51 void SetCurrentValue(const FileSpecList &value) {
52 std::lock_guard<std::recursive_mutex> lock(m_rmutex);
53 m_current_value = value;
54 }
55
56 void AppendCurrentValue(const FileSpec &value) {
57 std::lock_guard<std::recursive_mutex> lock(m_rmutex);
58 m_current_value.Append(value);
59 }
60
61protected:
62 lldb::OptionValueSP Clone() const override;
63
64 void ClearImpl() override {
65 m_current_value.Clear();
66 m_value_was_set = false;
67 }
68 // FIXME: This could use the existing m_mutex from the OptionValue
69 // parent class, but needs clean up in callsites to avoid deadlock.
70 mutable std::recursive_mutex m_rmutex;
72};
73
74} // namespace lldb_private
75
76#endif // LLDB_INTERPRETER_OPTIONVALUEFILESPECLIST_H
A class that implements CRTP-based "virtual constructor" idiom.
Definition Cloneable.h:40
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A file collection class.
A file utility class.
Definition FileSpec.h:57
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
void AppendCurrentValue(const FileSpec &value)
void SetCurrentValue(const FileSpecList &value)
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override
~OptionValueFileSpecList() override=default
OptionValueFileSpecList(const OptionValueFileSpecList &other)
lldb::OptionValueSP Clone() const override
OptionValue::Type GetType() const 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.
std::shared_ptr< lldb_private::OptionValue > OptionValueSP