@@ -420,7 +420,9 @@ class ValueObject : public UserID {
420
420
return (GetBitfieldBitSize () != 0 ) || (GetBitfieldBitOffset () != 0 );
421
421
}
422
422
423
- virtual bool IsArrayItemForPointer () { return m_is_array_item_for_pointer; }
423
+ virtual bool IsArrayItemForPointer () {
424
+ return m_flags.m_is_array_item_for_pointer ;
425
+ }
424
426
425
427
virtual const char *GetValueAsCString ();
426
428
@@ -744,7 +746,9 @@ class ValueObject : public UserID {
744
746
745
747
AddressType GetAddressTypeOfChildren ();
746
748
747
- void SetHasCompleteType () { m_did_calculate_complete_objc_class_type = true ; }
749
+ void SetHasCompleteType () {
750
+ m_flags.m_did_calculate_complete_objc_class_type = true ;
751
+ }
748
752
749
753
// / Find out if a ValueObject might have children.
750
754
// /
@@ -815,99 +819,109 @@ class ValueObject : public UserID {
815
819
};
816
820
817
821
// Classes that inherit from ValueObject can see and modify these
818
- ValueObject
819
- *m_parent; // The parent value object, or nullptr if this has no parent
820
- ValueObject *m_root; // The root of the hierarchy for this ValueObject (or
821
- // nullptr if never calculated)
822
- EvaluationPoint m_update_point; // Stores both the stop id and the full
823
- // context at which this value was last
824
- // updated. When we are asked to update the value object, we check whether
825
- // the context & stop id are the same before updating.
826
- ConstString m_name; // The name of this object
827
- DataExtractor
828
- m_data; // A data extractor that can be used to extract the value.
822
+
823
+ // / The parent value object, or nullptr if this has no parent.
824
+ ValueObject *m_parent = nullptr ;
825
+ // / The root of the hierarchy for this ValueObject (or nullptr if never
826
+ // / calculated).
827
+ ValueObject *m_root = nullptr ;
828
+ // / Stores both the stop id and the full context at which this value was last
829
+ // / updated. When we are asked to update the value object, we check whether
830
+ // / the context & stop id are the same before updating.
831
+ EvaluationPoint m_update_point;
832
+ // / The name of this object.
833
+ ConstString m_name;
834
+ // / A data extractor that can be used to extract the value.
835
+ DataExtractor m_data;
829
836
Value m_value;
830
- Status
831
- m_error; // An error object that can describe any errors that occur when
832
- // updating values.
833
- std::string m_value_str; // Cached value string that will get cleared if/when
834
- // the value is updated.
835
- std::string m_old_value_str; // Cached old value string from the last time the
836
- // value was gotten
837
- std::string m_location_str; // Cached location string that will get cleared
838
- // if/when the value is updated.
839
- std::string m_summary_str; // Cached summary string that will get cleared
840
- // if/when the value is updated.
841
- std::string m_object_desc_str; // Cached result of the "object printer". This
842
- // differs from the summary
843
- // in that the summary is consed up by us, the object_desc_string is builtin.
844
-
845
- CompilerType m_override_type; // If the type of the value object should be
846
- // overridden, the type to impose.
847
-
848
- ValueObjectManager *m_manager; // This object is managed by the root object
849
- // (any ValueObject that gets created
850
- // without a parent.) The manager gets passed through all the generations of
851
- // dependent objects, and will keep the whole cluster of objects alive as
852
- // long as a shared pointer to any of them has been handed out. Shared
853
- // pointers to value objects must always be made with the GetSP method.
837
+ // / An error object that can describe any errors that occur when updating
838
+ // / values.
839
+ Status m_error;
840
+ // / Cached value string that will get cleared if/when the value is updated.
841
+ std::string m_value_str;
842
+ // / Cached old value string from the last time the value was gotten
843
+ std::string m_old_value_str;
844
+ // / Cached location string that will get cleared if/when the value is updated.
845
+ std::string m_location_str;
846
+ // / Cached summary string that will get cleared if/when the value is updated.
847
+ std::string m_summary_str;
848
+ // / Cached result of the "object printer". This differs from the summary
849
+ // / in that the summary is consed up by us, the object_desc_string is builtin.
850
+ std::string m_object_desc_str;
851
+ // / If the type of the value object should be overridden, the type to impose.
852
+ CompilerType m_override_type;
853
+
854
+ // / This object is managed by the root object (any ValueObject that gets
855
+ // / created without a parent.) The manager gets passed through all the
856
+ // / generations of dependent objects, and will keep the whole cluster of
857
+ // / objects alive as long as a shared pointer to any of them has been handed
858
+ // / out. Shared pointers to value objects must always be made with the GetSP
859
+ // / method.
860
+ ValueObjectManager *m_manager = nullptr ;
854
861
855
862
ChildrenManager m_children;
856
863
std::map<ConstString, ValueObject *> m_synthetic_children;
857
864
858
- ValueObject *m_dynamic_value;
859
- ValueObject *m_synthetic_value;
860
- ValueObject *m_deref_valobj;
865
+ ValueObject *m_dynamic_value = nullptr ;
866
+ ValueObject *m_synthetic_value = nullptr ;
867
+ ValueObject *m_deref_valobj = nullptr ;
861
868
862
- lldb::ValueObjectSP m_addr_of_valobj_sp; // We have to hold onto a shared
863
- // pointer to this one because it is
864
- // created
865
- // as an independent ValueObjectConstResult, which isn't managed by us.
869
+ // / We have to hold onto a shared pointer to this one because it is created
870
+ // / as an independent ValueObjectConstResult, which isn't managed by us.
871
+ lldb::ValueObjectSP m_addr_of_valobj_sp;
866
872
867
- lldb::Format m_format;
868
- lldb::Format m_last_format;
869
- uint32_t m_last_format_mgr_revision;
873
+ lldb::Format m_format = lldb::eFormatDefault ;
874
+ lldb::Format m_last_format = lldb::eFormatDefault ;
875
+ uint32_t m_last_format_mgr_revision = 0 ;
870
876
lldb::TypeSummaryImplSP m_type_summary_sp;
871
877
lldb::TypeFormatImplSP m_type_format_sp;
872
878
lldb::SyntheticChildrenSP m_synthetic_children_sp;
873
879
ProcessModID m_user_id_of_forced_summary;
874
- AddressType m_address_type_of_ptr_or_ref_children;
880
+ AddressType m_address_type_of_ptr_or_ref_children = eAddressTypeInvalid ;
875
881
876
882
llvm::SmallVector<uint8_t , 16 > m_value_checksum;
877
883
878
- lldb::LanguageType m_preferred_display_language;
879
-
880
- uint64_t m_language_flags;
881
-
882
- bool m_value_is_valid : 1 , m_value_did_change : 1 , m_children_count_valid : 1 ,
883
- m_old_value_valid : 1 , m_is_deref_of_parent : 1 ,
884
- m_is_array_item_for_pointer : 1 , m_is_bitfield_for_scalar : 1 ,
885
- m_is_child_at_offset : 1 , m_is_getting_summary : 1 ,
886
- m_did_calculate_complete_objc_class_type : 1 ,
887
- m_is_synthetic_children_generated : 1 ;
884
+ lldb::LanguageType m_preferred_display_language = lldb::eLanguageTypeUnknown;
885
+
886
+ uint64_t m_language_flags = 0 ;
887
+
888
+ // Utility class for initializing all bitfields in ValueObject's constructors.
889
+ // FIXME: This could be done via default initializers once we have C++20.
890
+ struct Bitflags {
891
+ bool m_value_is_valid : 1 , m_value_did_change : 1 ,
892
+ m_children_count_valid : 1 , m_old_value_valid : 1 ,
893
+ m_is_deref_of_parent : 1 , m_is_array_item_for_pointer : 1 ,
894
+ m_is_bitfield_for_scalar : 1 , m_is_child_at_offset : 1 ,
895
+ m_is_getting_summary : 1 , m_did_calculate_complete_objc_class_type : 1 ,
896
+ m_is_synthetic_children_generated : 1 ;
897
+ Bitflags () {
898
+ m_value_is_valid = false ;
899
+ m_value_did_change = false ;
900
+ m_children_count_valid = false ;
901
+ m_old_value_valid = false ;
902
+ m_is_deref_of_parent = false ;
903
+ m_is_array_item_for_pointer = false ;
904
+ m_is_bitfield_for_scalar = false ;
905
+ m_is_child_at_offset = false ;
906
+ m_is_getting_summary = false ;
907
+ m_did_calculate_complete_objc_class_type = false ;
908
+ m_is_synthetic_children_generated = false ;
909
+ }
910
+ } m_flags;
888
911
889
912
friend class ValueObjectChild ;
890
913
friend class ExpressionVariable ; // For SetName
891
914
friend class Target ; // For SetName
892
915
friend class ValueObjectConstResultImpl ;
893
916
friend class ValueObjectSynthetic ; // For ClearUserVisibleData
894
917
895
- // Constructors and Destructors
896
-
897
- // Use the no-argument constructor to make a constant variable object (with
898
- // no ExecutionContextScope.)
899
-
900
- ValueObject ();
901
-
902
- // Use this constructor to create a "root variable object". The ValueObject
903
- // will be locked to this context through-out its lifespan.
904
-
918
+ // / Use this constructor to create a "root variable object". The ValueObject
919
+ // / will be locked to this context through-out its lifespan.
905
920
ValueObject (ExecutionContextScope *exe_scope, ValueObjectManager &manager,
906
921
AddressType child_ptr_or_ref_addr_type = eAddressTypeLoad);
907
922
908
- // Use this constructor to create a ValueObject owned by another ValueObject.
909
- // It will inherit the ExecutionContext of its parent.
910
-
923
+ // / Use this constructor to create a ValueObject owned by another ValueObject.
924
+ // / It will inherit the ExecutionContext of its parent.
911
925
ValueObject (ValueObject &parent);
912
926
913
927
ValueObjectManager *GetManager () { return m_manager; }
0 commit comments