Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===-- ValueObjectVariable.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_VALUEOBJECTVARIABLE_H
0010 #define LLDB_VALUEOBJECT_VALUEOBJECTVARIABLE_H
0011 
0012 #include "lldb/ValueObject/ValueObject.h"
0013 
0014 #include "lldb/Core/Value.h"
0015 #include "lldb/Symbol/CompilerType.h"
0016 #include "lldb/Utility/ConstString.h"
0017 #include "lldb/lldb-defines.h"
0018 #include "lldb/lldb-enumerations.h"
0019 #include "lldb/lldb-forward.h"
0020 
0021 #include <cstddef>
0022 #include <cstdint>
0023 #include <optional>
0024 
0025 namespace lldb_private {
0026 class DataExtractor;
0027 class Declaration;
0028 class Status;
0029 class ExecutionContextScope;
0030 class SymbolContextScope;
0031 
0032 /// A ValueObject that contains a root variable that may or may not
0033 /// have children.
0034 class ValueObjectVariable : public ValueObject {
0035 public:
0036   ~ValueObjectVariable() override;
0037 
0038   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
0039                                     const lldb::VariableSP &var_sp);
0040 
0041   std::optional<uint64_t> GetByteSize() override;
0042 
0043   ConstString GetTypeName() override;
0044 
0045   ConstString GetQualifiedTypeName() override;
0046 
0047   ConstString GetDisplayTypeName() override;
0048 
0049   llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
0050 
0051   lldb::ValueType GetValueType() const override;
0052 
0053   bool IsInScope() override;
0054 
0055   lldb::ModuleSP GetModule() override;
0056 
0057   SymbolContextScope *GetSymbolContextScope() override;
0058 
0059   bool GetDeclaration(Declaration &decl) override;
0060 
0061   const char *GetLocationAsCString() override;
0062 
0063   bool SetValueFromCString(const char *value_str, Status &error) override;
0064 
0065   bool SetData(DataExtractor &data, Status &error) override;
0066 
0067   lldb::VariableSP GetVariable() override { return m_variable_sp; }
0068 
0069 protected:
0070   bool UpdateValue() override;
0071 
0072   void DoUpdateChildrenAddressType(ValueObject &valobj) override;
0073 
0074   CompilerType GetCompilerTypeImpl() override;
0075 
0076   /// The variable that this value object is based upon.
0077   lldb::VariableSP m_variable_sp;
0078   ///< The value that DWARFExpression resolves this variable to before we patch
0079   ///< it up.
0080   Value m_resolved_value;
0081 
0082 private:
0083   ValueObjectVariable(ExecutionContextScope *exe_scope,
0084                       ValueObjectManager &manager,
0085                       const lldb::VariableSP &var_sp);
0086   // For ValueObject only
0087   ValueObjectVariable(const ValueObjectVariable &) = delete;
0088   const ValueObjectVariable &operator=(const ValueObjectVariable &) = delete;
0089 };
0090 
0091 } // namespace lldb_private
0092 
0093 #endif // LLDB_VALUEOBJECT_VALUEOBJECTVARIABLE_H