diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -349,10 +349,10 @@ void SetNeedsUpdate(); - CompilerType GetCompilerType(); + CompilerType GetCompilerType() { return MaybeCalculateCompleteType(); } // this vends a TypeImpl that is useful at the SB API layer - virtual TypeImpl GetTypeImpl(); + virtual TypeImpl GetTypeImpl() { return TypeImpl(GetCompilerType()); } virtual bool CanProvideValue(); @@ -362,24 +362,32 @@ virtual lldb::ValueType GetValueType() const = 0; // Subclasses can implement the functions below. - virtual ConstString GetTypeName(); + virtual ConstString GetTypeName() { return GetCompilerType().GetTypeName(); } - virtual ConstString GetDisplayTypeName(); + virtual ConstString GetDisplayTypeName() { return GetTypeName(); } - virtual ConstString GetQualifiedTypeName(); + virtual ConstString GetQualifiedTypeName() { + return GetCompilerType().GetTypeName(); + } - virtual lldb::LanguageType GetObjectRuntimeLanguage(); + virtual lldb::LanguageType GetObjectRuntimeLanguage() { + return GetCompilerType().GetMinimumLanguage(); + } virtual uint32_t - GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr); + GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr) { + return GetCompilerType().GetTypeInfo(pointee_or_element_compiler_type); + } - virtual bool IsPointerType(); + virtual bool IsPointerType() { return GetCompilerType().IsPointerType(); } - virtual bool IsArrayType(); + virtual bool IsArrayType() { return GetCompilerType().IsArrayType(); } - virtual bool IsScalarType(); + virtual bool IsScalarType() { return GetCompilerType().IsScalarType(); } - virtual bool IsPointerOrReferenceType(); + virtual bool IsPointerOrReferenceType() { + return GetCompilerType().IsPointerOrReferenceType(); + } virtual bool IsPossibleDynamicType(); @@ -393,7 +401,9 @@ virtual bool IsDereferenceOfParent() { return false; } - bool IsIntegerType(bool &is_signed); + bool IsIntegerType(bool &is_signed) { + return GetCompilerType().IsIntegerType(is_signed); + } virtual void GetExpressionPath( Stream &s, @@ -454,7 +464,7 @@ // The functions below should NOT be modified by subclasses const Status &GetError(); - ConstString GetName() const; + ConstString GetName() const { return m_name; } /// Returns a unique id for this ValueObject. lldb::user_id_t GetID() const { return m_id.GetID(); } @@ -484,9 +494,9 @@ size_t GetNumChildren(uint32_t max = UINT32_MAX); - const Value &GetValue() const; + const Value &GetValue() const { return m_value; } - Value &GetValue(); + Value &GetValue() { return m_value; } virtual bool ResolveValue(Scalar &scalar); @@ -495,7 +505,9 @@ // potentially a few others virtual bool IsLogicalTrue(Status &error); - virtual const char *GetLocationAsCString(); + virtual const char *GetLocationAsCString() { + return GetLocationAsCStringImpl(m_value, m_data); + } const char * GetSummaryAsCString(lldb::LanguageType lang = lldb::eLanguageTypeUnknown); @@ -530,11 +542,11 @@ PrintableRepresentationSpecialCases special = PrintableRepresentationSpecialCases::eAllow, bool do_dump_error = true); - bool GetValueIsValid() const; + bool GetValueIsValid() const { return m_flags.m_value_is_valid; } // If you call this on a newly created ValueObject, it will always return // false. - bool GetValueDidChange(); + bool GetValueDidChange() { return m_flags.m_value_did_change; } bool UpdateValueIfNeeded(bool update_format = true); @@ -545,7 +557,7 @@ /// Change the name of the current ValueObject. Should *not* be used from a /// synthetic child provider as it would change the name of the non synthetic /// child as well. - void SetName(ConstString name); + void SetName(ConstString name) { m_name = name; } virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true, AddressType *address_type = nullptr); @@ -575,9 +587,9 @@ lldb::DynamicValueType GetDynamicValueType(); - virtual lldb::ValueObjectSP GetStaticValue(); + virtual lldb::ValueObjectSP GetStaticValue() { return GetSP(); } - virtual lldb::ValueObjectSP GetNonSyntheticValue(); + virtual lldb::ValueObjectSP GetNonSyntheticValue() { return GetSP(); } lldb::ValueObjectSP GetSyntheticValue(); @@ -626,9 +638,13 @@ virtual bool DoesProvideSyntheticValue() { return false; } - virtual bool IsSyntheticChildrenGenerated(); + virtual bool IsSyntheticChildrenGenerated() { + return m_flags.m_is_synthetic_children_generated; + } - virtual void SetSyntheticChildrenGenerated(bool b); + virtual void SetSyntheticChildrenGenerated(bool b) { + m_flags.m_is_synthetic_children_generated = b; + } virtual SymbolContextScope *GetSymbolContextScope(); @@ -694,7 +710,9 @@ virtual lldb::LanguageType GetPreferredDisplayLanguage(); - void SetPreferredDisplayLanguage(lldb::LanguageType); + void SetPreferredDisplayLanguage(lldb::LanguageType lt) { + m_preferred_display_language = lt; + } lldb::TypeSummaryImplSP GetSummaryFormat() { UpdateFormatsIfNeeded(); @@ -768,9 +786,9 @@ virtual bool IsRuntimeSupportValue(); - virtual uint64_t GetLanguageFlags(); + virtual uint64_t GetLanguageFlags() { return m_language_flags; } - virtual void SetLanguageFlags(uint64_t flags); + virtual void SetLanguageFlags(uint64_t flags) { m_language_flags = flags; } protected: typedef ClusterManager ValueObjectManager; @@ -955,9 +973,11 @@ void SetNumChildren(size_t num_children); - void SetValueDidChange(bool value_changed); + void SetValueDidChange(bool value_changed) { + m_flags.m_value_did_change = value_changed; + } - void SetValueIsValid(bool valid); + void SetValueIsValid(bool valid) { m_flags.m_value_is_valid = valid; } void ClearUserVisibleData( uint32_t items = ValueObject::eClearUserVisibleDataItemsAllStrings); @@ -975,7 +995,7 @@ const char *GetLocationAsCStringImpl(const Value &value, const DataExtractor &data); - bool IsChecksumEmpty(); + bool IsChecksumEmpty() { return m_value_checksum.empty(); } void SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType); diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -62,6 +62,8 @@ #include #include +#include + namespace lldb_private { class ExecutionContextScope; } @@ -271,11 +273,7 @@ return compiler_type; } -CompilerType ValueObject::GetCompilerType() { - return MaybeCalculateCompleteType(); -} -TypeImpl ValueObject::GetTypeImpl() { return TypeImpl(GetCompilerType()); } DataExtractor &ValueObject::GetDataExtractor() { UpdateValueIfNeeded(false); @@ -287,12 +285,6 @@ return m_error; } -ConstString ValueObject::GetName() const { return m_name; } - -const char *ValueObject::GetLocationAsCString() { - return GetLocationAsCStringImpl(m_value, m_data); -} - const char *ValueObject::GetLocationAsCStringImpl(const Value &value, const DataExtractor &data) { if (UpdateValueIfNeeded(false)) { @@ -337,10 +329,6 @@ return m_location_str.c_str(); } -Value &ValueObject::GetValue() { return m_value; } - -const Value &ValueObject::GetValue() const { return m_value; } - bool ValueObject::ResolveValue(Scalar &scalar) { if (UpdateValueIfNeeded( false)) // make sure that you are up to date before returning anything @@ -384,16 +372,6 @@ return ret; } -bool ValueObject::GetValueIsValid() const { return m_flags.m_value_is_valid; } - -void ValueObject::SetValueIsValid(bool b) { m_flags.m_value_is_valid = b; } - -bool ValueObject::GetValueDidChange() { return m_flags.m_value_did_change; } - -void ValueObject::SetValueDidChange(bool value_changed) { - m_flags.m_value_did_change = value_changed; -} - ValueObjectSP ValueObject::GetChildAtIndex(size_t idx, bool can_create) { ValueObjectSP child_sp; // We may need to update our value if we are dynamic @@ -550,8 +528,6 @@ m_children.SetChildrenCount(num_children); } -void ValueObject::SetName(ConstString name) { m_name = name; } - ValueObject *ValueObject::CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) { @@ -1573,20 +1549,6 @@ return false; } -ConstString ValueObject::GetTypeName() { - return GetCompilerType().GetTypeName(); -} - -ConstString ValueObject::GetDisplayTypeName() { return GetTypeName(); } - -ConstString ValueObject::GetQualifiedTypeName() { - return GetCompilerType().GetTypeName(); -} - -LanguageType ValueObject::GetObjectRuntimeLanguage() { - return GetCompilerType().GetMinimumLanguage(); -} - void ValueObject::AddSyntheticChild(ConstString key, ValueObject *valobj) { m_synthetic_children[key] = valobj; @@ -1601,25 +1563,6 @@ return synthetic_child_sp; } -uint32_t -ValueObject::GetTypeInfo(CompilerType *pointee_or_element_compiler_type) { - return GetCompilerType().GetTypeInfo(pointee_or_element_compiler_type); -} - -bool ValueObject::IsPointerType() { return GetCompilerType().IsPointerType(); } - -bool ValueObject::IsArrayType() { return GetCompilerType().IsArrayType(); } - -bool ValueObject::IsScalarType() { return GetCompilerType().IsScalarType(); } - -bool ValueObject::IsIntegerType(bool &is_signed) { - return GetCompilerType().IsIntegerType(is_signed); -} - -bool ValueObject::IsPointerOrReferenceType() { - return GetCompilerType().IsPointerOrReferenceType(); -} - bool ValueObject::IsPossibleDynamicType() { ExecutionContext exe_ctx(GetExecutionContextRef()); Process *process = exe_ctx.GetProcessPtr(); @@ -1899,10 +1842,6 @@ return ValueObjectSP(); } -ValueObjectSP ValueObject::GetStaticValue() { return GetSP(); } - -lldb::ValueObjectSP ValueObject::GetNonSyntheticValue() { return GetSP(); } - ValueObjectSP ValueObject::GetSyntheticValue() { CalculateSyntheticValue(); @@ -3154,10 +3093,6 @@ return (m_preferred_display_language = type); // only compute it once } -void ValueObject::SetPreferredDisplayLanguage(lldb::LanguageType lt) { - m_preferred_display_language = lt; -} - void ValueObject::SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType lt) { if (m_preferred_display_language == lldb::eLanguageTypeUnknown) SetPreferredDisplayLanguage(lt); @@ -3171,7 +3106,7 @@ return (!type.IsValid()) || (0 != (type.GetTypeInfo() & eTypeHasValue)); } -bool ValueObject::IsChecksumEmpty() { return m_value_checksum.empty(); } + ValueObjectSP ValueObject::Persist() { if (!UpdateValueIfNeeded()) @@ -3200,15 +3135,3 @@ return persistent_var_sp->GetValueObject(); } - -bool ValueObject::IsSyntheticChildrenGenerated() { - return m_flags.m_is_synthetic_children_generated; -} - -void ValueObject::SetSyntheticChildrenGenerated(bool b) { - m_flags.m_is_synthetic_children_generated = b; -} - -uint64_t ValueObject::GetLanguageFlags() { return m_language_flags; } - -void ValueObject::SetLanguageFlags(uint64_t flags) { m_language_flags = flags; }