Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:59

0001 //===-- ValueObjectDynamicValue.h -------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_VALUEOBJECT_VALUEOBJECTDYNAMICVALUE_H
0010 #define LLDB_VALUEOBJECT_VALUEOBJECTDYNAMICVALUE_H
0011 
0012 #include "lldb/Core/Address.h"
0013 #include "lldb/Symbol/CompilerType.h"
0014 #include "lldb/Symbol/Type.h"
0015 #include "lldb/Utility/ConstString.h"
0016 #include "lldb/ValueObject/ValueObject.h"
0017 #include "lldb/lldb-defines.h"
0018 #include "lldb/lldb-enumerations.h"
0019 #include "lldb/lldb-forward.h"
0020 #include "lldb/lldb-private-enumerations.h"
0021 
0022 #include <cassert>
0023 #include <cstddef>
0024 #include <cstdint>
0025 #include <optional>
0026 
0027 namespace lldb_private {
0028 class DataExtractor;
0029 class Declaration;
0030 class Status;
0031 
0032 /// A ValueObject that represents memory at a given address, viewed as some
0033 /// set lldb type.
0034 class ValueObjectDynamicValue : public ValueObject {
0035 public:
0036   ~ValueObjectDynamicValue() override = default;
0037 
0038   std::optional<uint64_t> GetByteSize() override;
0039 
0040   ConstString GetTypeName() override;
0041 
0042   ConstString GetQualifiedTypeName() override;
0043 
0044   ConstString GetDisplayTypeName() override;
0045 
0046   llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
0047 
0048   lldb::ValueType GetValueType() const override;
0049 
0050   bool IsInScope() override;
0051 
0052   bool IsDynamic() override { return true; }
0053 
0054   bool IsBaseClass() override {
0055     if (m_parent)
0056       return m_parent->IsBaseClass();
0057     return false;
0058   }
0059 
0060   bool GetIsConstant() const override { return false; }
0061 
0062   ValueObject *GetParent() override {
0063     return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
0064   }
0065 
0066   const ValueObject *GetParent() const override {
0067     return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
0068   }
0069 
0070   lldb::ValueObjectSP GetStaticValue() override { return m_parent->GetSP(); }
0071 
0072   bool SetValueFromCString(const char *value_str, Status &error) override;
0073 
0074   bool SetData(DataExtractor &data, Status &error) override;
0075 
0076   TypeImpl GetTypeImpl() override;
0077 
0078   lldb::VariableSP GetVariable() override {
0079     return m_parent ? m_parent->GetVariable() : nullptr;
0080   }
0081 
0082   lldb::LanguageType GetPreferredDisplayLanguage() override;
0083 
0084   void SetPreferredDisplayLanguage(lldb::LanguageType);
0085 
0086   bool IsSyntheticChildrenGenerated() override;
0087 
0088   void SetSyntheticChildrenGenerated(bool b) override;
0089 
0090   bool GetDeclaration(Declaration &decl) override;
0091 
0092   uint64_t GetLanguageFlags() override;
0093 
0094   void SetLanguageFlags(uint64_t flags) override;
0095 
0096 protected:
0097   bool UpdateValue() override;
0098 
0099   LazyBool CanUpdateWithInvalidExecutionContext() override {
0100     return eLazyBoolYes;
0101   }
0102 
0103   lldb::DynamicValueType GetDynamicValueTypeImpl() override {
0104     return m_use_dynamic;
0105   }
0106 
0107   bool HasDynamicValueTypeInfo() override { return true; }
0108 
0109   CompilerType GetCompilerTypeImpl() override;
0110 
0111   Address m_address; ///< The variable that this value object is based upon
0112   TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
0113   lldb::DynamicValueType m_use_dynamic;
0114   TypeImpl m_type_impl;
0115 
0116 private:
0117   friend class ValueObject;
0118   friend class ValueObjectConstResult;
0119   ValueObjectDynamicValue(ValueObject &parent,
0120                           lldb::DynamicValueType use_dynamic);
0121 
0122   ValueObjectDynamicValue(const ValueObjectDynamicValue &) = delete;
0123   const ValueObjectDynamicValue &
0124   operator=(const ValueObjectDynamicValue &) = delete;
0125 };
0126 
0127 } // namespace lldb_private
0128 
0129 #endif // LLDB_VALUEOBJECT_VALUEOBJECTDYNAMICVALUE_H