[Lldb-commits] [PATCH] D30272: Improve data formatter for libstdcpp	unique_ptr
    Tamas Berghammer via Phabricator via lldb-commits 
    lldb-commits at lists.llvm.org
       
    Fri Feb 24 07:14:15 PST 2017
    
    
  
tberghammer added a comment.
Thank you the comments. Based on them I have the following proposal:
- Add a new property to value object with name "m_is_dereference_of_parent"
- Add a new static method named "CreateCopy(name, valobj, is_dereference_of_parent)" to ValueObject and to SBValue what will create a new value object with the same type and data as the original value object with m_is_dereference_of_parent is set (I am open to suggestions for a better name). The reason I need to create a copy of the value object instead of modifying it in place is that if the dereferenced object is referenced without using a synthetic child provider then this flag shouldn't be set and the cleanest way to achieve this is to have 2 separate value object instances.
- From the synthetic child providers when we want to create a child what is the dereference of the parent (e.g. object for unique_ptr) then we will use the above CreateCopy method
- We will decrement the pointer depth during display every time we go through an object marked as m_is_dereference_of_parent
- In "frame variable" when the user uses "operator*" or "operator->" we return the first child with m_is_dereference_of_parent (possibly return an error if multiple child has it set)
I think this approach satisfies all the requirements we had (extensibility, dereference support, loop detection) and makes the API fairly clean. What do you think?
https://reviews.llvm.org/D30272
    
    
More information about the lldb-commits
mailing list