Coverage Report

Created: 2023-09-30 09:22

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Core/ValueObjectDynamicValue.h
Line
Count
Source (jump to first uncovered line)
1
//===-- ValueObjectDynamicValue.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_CORE_VALUEOBJECTDYNAMICVALUE_H
10
#define LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
11
12
#include "lldb/Core/Address.h"
13
#include "lldb/Core/ValueObject.h"
14
#include "lldb/Symbol/CompilerType.h"
15
#include "lldb/Symbol/Type.h"
16
#include "lldb/Utility/ConstString.h"
17
#include "lldb/lldb-defines.h"
18
#include "lldb/lldb-enumerations.h"
19
#include "lldb/lldb-forward.h"
20
#include "lldb/lldb-private-enumerations.h"
21
22
#include <cassert>
23
#include <cstddef>
24
#include <cstdint>
25
#include <optional>
26
27
namespace lldb_private {
28
class DataExtractor;
29
class Declaration;
30
class Status;
31
32
/// A ValueObject that represents memory at a given address, viewed as some
33
/// set lldb type.
34
class ValueObjectDynamicValue : public ValueObject {
35
public:
36
1.53k
  ~ValueObjectDynamicValue() override = default;
37
38
  std::optional<uint64_t> GetByteSize() override;
39
40
  ConstString GetTypeName() override;
41
42
  ConstString GetQualifiedTypeName() override;
43
44
  ConstString GetDisplayTypeName() override;
45
46
  size_t CalculateNumChildren(uint32_t max) override;
47
48
  lldb::ValueType GetValueType() const override;
49
50
  bool IsInScope() override;
51
52
5.46k
  bool IsDynamic() override { return true; }
53
54
2.02k
  bool IsBaseClass() override {
55
2.02k
    if (m_parent)
56
2.02k
      return m_parent->IsBaseClass();
57
0
    return false;
58
2.02k
  }
59
60
52.0k
  bool GetIsConstant() const override { return false; }
61
62
226
  ValueObject *GetParent() override {
63
226
    return ((m_parent != nullptr) ? m_parent->GetParent() : 
nullptr0
);
64
226
  }
65
66
0
  const ValueObject *GetParent() const override {
67
0
    return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
68
0
  }
69
70
3.38k
  lldb::ValueObjectSP GetStaticValue() override { return m_parent->GetSP(); }
71
72
  bool SetValueFromCString(const char *value_str, Status &error) override;
73
74
  bool SetData(DataExtractor &data, Status &error) override;
75
76
  TypeImpl GetTypeImpl() override;
77
78
12
  lldb::VariableSP GetVariable() override {
79
12
    return m_parent ? m_parent->GetVariable() : 
nullptr0
;
80
12
  }
81
82
  lldb::LanguageType GetPreferredDisplayLanguage() override;
83
84
  void SetPreferredDisplayLanguage(lldb::LanguageType);
85
86
  bool IsSyntheticChildrenGenerated() override;
87
88
  void SetSyntheticChildrenGenerated(bool b) override;
89
90
  bool GetDeclaration(Declaration &decl) override;
91
92
  uint64_t GetLanguageFlags() override;
93
94
  void SetLanguageFlags(uint64_t flags) override;
95
96
protected:
97
  bool UpdateValue() override;
98
99
52.8k
  LazyBool CanUpdateWithInvalidExecutionContext() override {
100
52.8k
    return eLazyBoolYes;
101
52.8k
  }
102
103
4.30k
  lldb::DynamicValueType GetDynamicValueTypeImpl() override {
104
4.30k
    return m_use_dynamic;
105
4.30k
  }
106
107
4.30k
  bool HasDynamicValueTypeInfo() override { return true; }
108
109
  CompilerType GetCompilerTypeImpl() override;
110
111
  Address m_address; ///< The variable that this value object is based upon
112
  TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
113
  lldb::DynamicValueType m_use_dynamic;
114
  TypeImpl m_type_impl;
115
116
private:
117
  friend class ValueObject;
118
  friend class ValueObjectConstResult;
119
  ValueObjectDynamicValue(ValueObject &parent,
120
                          lldb::DynamicValueType use_dynamic);
121
122
  ValueObjectDynamicValue(const ValueObjectDynamicValue &) = delete;
123
  const ValueObjectDynamicValue &
124
  operator=(const ValueObjectDynamicValue &) = delete;
125
};
126
127
} // namespace lldb_private
128
129
#endif // LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H