Coverage Report

Created: 2022-01-22 13:19

/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
26
namespace lldb_private {
27
class DataExtractor;
28
class Declaration;
29
class Status;
30
31
/// A ValueObject that represents memory at a given address, viewed as some
32
/// set lldb type.
33
class ValueObjectDynamicValue : public ValueObject {
34
public:
35
1.04k
  ~ValueObjectDynamicValue() = default;
36
37
  llvm::Optional<uint64_t> GetByteSize() override;
38
39
  ConstString GetTypeName() override;
40
41
  ConstString GetQualifiedTypeName() override;
42
43
  ConstString GetDisplayTypeName() override;
44
45
  size_t CalculateNumChildren(uint32_t max) override;
46
47
  lldb::ValueType GetValueType() const override;
48
49
  bool IsInScope() override;
50
51
7.37k
  bool IsDynamic() override { return true; }
52
53
1.95k
  bool IsBaseClass() override {
54
1.95k
    if (m_parent)
55
1.95k
      return m_parent->IsBaseClass();
56
0
    return false;
57
1.95k
  }
58
59
51.4k
  bool GetIsConstant() const override { return false; }
60
61
97
  ValueObject *GetParent() override {
62
97
    return ((m_parent != nullptr) ? m_parent->GetParent() : 
nullptr0
);
63
97
  }
64
65
0
  const ValueObject *GetParent() const override {
66
0
    return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
67
0
  }
68
69
4.67k
  lldb::ValueObjectSP GetStaticValue() override { return m_parent->GetSP(); }
70
71
  bool SetValueFromCString(const char *value_str, Status &error) override;
72
73
  bool SetData(DataExtractor &data, Status &error) override;
74
75
  TypeImpl GetTypeImpl() override;
76
77
0
  lldb::VariableSP GetVariable() override {
78
0
    return m_parent ? m_parent->GetVariable() : nullptr;
79
0
  }
80
81
  lldb::LanguageType GetPreferredDisplayLanguage() override;
82
83
  void SetPreferredDisplayLanguage(lldb::LanguageType);
84
85
  bool IsSyntheticChildrenGenerated() override;
86
87
  void SetSyntheticChildrenGenerated(bool b) override;
88
89
  bool GetDeclaration(Declaration &decl) override;
90
91
  uint64_t GetLanguageFlags() override;
92
93
  void SetLanguageFlags(uint64_t flags) override;
94
95
protected:
96
  bool UpdateValue() override;
97
98
52.0k
  LazyBool CanUpdateWithInvalidExecutionContext() override {
99
52.0k
    return eLazyBoolYes;
100
52.0k
  }
101
102
5.81k
  lldb::DynamicValueType GetDynamicValueTypeImpl() override {
103
5.81k
    return m_use_dynamic;
104
5.81k
  }
105
106
5.81k
  bool HasDynamicValueTypeInfo() override { return true; }
107
108
  CompilerType GetCompilerTypeImpl() override;
109
110
  Address m_address; ///< The variable that this value object is based upon
111
  TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
112
  lldb::DynamicValueType m_use_dynamic;
113
  TypeImpl m_type_impl;
114
115
private:
116
  friend class ValueObject;
117
  friend class ValueObjectConstResult;
118
  ValueObjectDynamicValue(ValueObject &parent,
119
                          lldb::DynamicValueType use_dynamic);
120
121
  ValueObjectDynamicValue(const ValueObjectDynamicValue &) = delete;
122
  const ValueObjectDynamicValue &
123
  operator=(const ValueObjectDynamicValue &) = delete;
124
};
125
126
} // namespace lldb_private
127
128
#endif // LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H