LLDB mainline
ValueObjectCast.h
Go to the documentation of this file.
1//===-- ValueObjectCast.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_VALUEOBJECT_VALUEOBJECTCAST_H
10#define LLDB_VALUEOBJECT_VALUEOBJECTCAST_H
11
14#include "lldb/lldb-defines.h"
16#include "lldb/lldb-forward.h"
17
18#include <cstddef>
19#include <cstdint>
20#include <optional>
21
22namespace lldb_private {
23
24/// A ValueObject that represents a given value represented as a different type.
26public:
27 ~ValueObjectCast() override;
28
29 static lldb::ValueObjectSP Create(ValueObject &parent, llvm::StringRef name,
30 const CompilerType &cast_type);
31
32 llvm::Expected<uint64_t> GetByteSize() override;
33
34 llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
35
36 lldb::ValueType GetValueType() const override;
37
38 bool IsInScope() override;
39
40 AddrAndType GetAddressOf(bool scalar_is_load_address = true) override;
41
42 const char *GetLocationAsCString() override;
43
44 llvm::Error CanSetValue() override;
45
46 ValueObject *GetParent() override {
47 return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
48 }
49
50 const ValueObject *GetParent() const override {
51 return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
52 }
53
54protected:
55 ValueObjectCast(ValueObject &parent, llvm::StringRef name,
56 const CompilerType &cast_type);
57
58 bool UpdateValue() override;
59
61
63
64private:
65 /// True if the value is a scalar but the cast lives in the parent's storage.
67
69 const ValueObjectCast &operator=(const ValueObjectCast &) = delete;
70};
71
72} // namespace lldb_private
73
74#endif // LLDB_VALUEOBJECT_VALUEOBJECTCAST_H
Generic representation of a type in a programming language.
CompilerType GetCompilerTypeImpl() override
llvm::Expected< uint32_t > CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
llvm::Expected< uint64_t > GetByteSize() override
const ValueObjectCast & operator=(const ValueObjectCast &)=delete
ValueObject * GetParent() override
ValueObjectCast(const ValueObjectCast &)=delete
static lldb::ValueObjectSP Create(ValueObject &parent, llvm::StringRef name, const CompilerType &cast_type)
bool LivesInParentStorage()
True if the value is a scalar but the cast lives in the parent's storage.
llvm::Error CanSetValue() override
Check if the value may be writable.
ValueObjectCast(ValueObject &parent, llvm::StringRef name, const CompilerType &cast_type)
AddrAndType GetAddressOf(bool scalar_is_load_address=true) override
const char * GetLocationAsCString() override
lldb::ValueType GetValueType() const override
const ValueObject * GetParent() const override
ValueObject(ExecutionContextScope *exe_scope, ValueObjectManager &manager, AddressType child_ptr_or_ref_addr_type=eAddressTypeLoad)
Use this constructor to create a "root variable object".
ValueObject * m_parent
The parent value object, or nullptr if this has no parent.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP