Coverage Report

Created: 2022-01-25 06:29

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Interpreter/OptionValueDictionary.h
Line
Count
Source (jump to first uncovered line)
1
//===-- OptionValueDictionary.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_OPTIONVALUEDICTIONARY_H
10
#define LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H
11
12
#include <map>
13
14
#include "lldb/Interpreter/OptionValue.h"
15
16
namespace lldb_private {
17
18
class OptionValueDictionary
19
    : public Cloneable<OptionValueDictionary, OptionValue> {
20
public:
21
  OptionValueDictionary(uint32_t type_mask = UINT32_MAX,
22
                        bool raw_value_dump = true)
23
11.0k
      : m_type_mask(type_mask), m_raw_value_dump(raw_value_dump) {}
24
25
16.5k
  ~OptionValueDictionary() override = default;
26
27
  // Virtual subclass pure virtual overrides
28
29
49.0k
  OptionValue::Type GetType() const override { return eTypeDictionary; }
30
31
  void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
32
                 uint32_t dump_mask) override;
33
34
  Status
35
  SetValueFromString(llvm::StringRef value,
36
                     VarSetOperationType op = eVarSetOperationAssign) override;
37
38
10.2k
  void Clear() override {
39
10.2k
    m_values.clear();
40
10.2k
    m_value_was_set = false;
41
10.2k
  }
42
43
  lldb::OptionValueSP
44
  DeepCopy(const lldb::OptionValueSP &new_parent) const override;
45
46
0
  bool IsAggregateValue() const override { return true; }
47
48
0
  bool IsHomogenous() const {
49
0
    return ConvertTypeMaskToType(m_type_mask) != eTypeInvalid;
50
0
  }
51
52
  // Subclass specific functions
53
54
  size_t GetNumValues() const { return m_values.size(); }
55
56
  lldb::OptionValueSP GetValueForKey(ConstString key) const;
57
58
  lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
59
                                  llvm::StringRef name, bool will_modify,
60
                                  Status &error) const override;
61
62
  Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op,
63
                     llvm::StringRef name, llvm::StringRef value) override;
64
65
  bool SetValueForKey(ConstString key,
66
                      const lldb::OptionValueSP &value_sp,
67
                      bool can_replace = true);
68
69
  bool DeleteValueForKey(ConstString key);
70
71
  size_t GetArgs(Args &args) const;
72
73
  Status SetArgs(const Args &args, VarSetOperationType op);
74
75
protected:
76
  typedef std::map<ConstString, lldb::OptionValueSP> collection;
77
  uint32_t m_type_mask;
78
  collection m_values;
79
  bool m_raw_value_dump;
80
};
81
82
} // namespace lldb_private
83
84
#endif // LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H