<div dir="ltr">Thanks for the clarification, I wrote "try to convert" there because I didn't look closely enough to see what problem it was solving.  Since it seems to be specific to ValueObject (which a grep confirms), we may be able to just move the code for SharingPtr next to ValueObject.  That said, SharingPtr.h / .cpp don't actually have any reverse dependencies, so we could also just leave it alone.  I mostly just put that on the list because if we intend for this to be a general purpose library of reusable stuff, we might as well remove things that are not seeing broad use.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 31, 2017 at 4:32 PM Jim Ingham <<a href="mailto:jingham@apple.com">jingham@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="gmail_msg">
> On Jan 31, 2017, at 3:59 PM, Zachary Turner via Phabricator via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" class="gmail_msg" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br class="gmail_msg">
><br class="gmail_msg">
> zturner created this revision.<br class="gmail_msg">
> Herald added a subscriber: mgorny.<br class="gmail_msg">
><br class="gmail_msg">
> The goal here is to make `lldbUtility` a library which depends on no other libraries.  It seems like this library already exists in spirit as a place to house very low level code which is commonly used by all parts of LLDB, so it makes sense to designate this as the one top-level library.  We can change the name in the future to something like `Support` if we choose to (implying that it is analogous to LLVMSupport), but for now I just want to break the dependencies.<br class="gmail_msg">
><br class="gmail_msg">
> So, this patch deletes a bunch of dead code and moves some code that is actually only used in 1-2 places up to where it's actually used.<br class="gmail_msg">
><br class="gmail_msg">
> This is not enough to get `Utility` dependency free.  Further tasks that I've identified, but which are too large to fit into this patch, include:<br class="gmail_msg">
><br class="gmail_msg">
> 1. Move `RegularExpression` from Core -> Utility  (Long term: Delete and use LLVM)<br class="gmail_msg">
> 2. Move `Stream` from Core -> Utility  (Long term: Delete and use llvm::raw_ostream)<br class="gmail_msg">
> 3. Move `ConstString` from Core -> Utility<br class="gmail_msg">
> 4. Move `ProcessStructReader` from Utility -> Process<br class="gmail_msg">
> 5. Move `RegisterNumber` from Utility -> Target<br class="gmail_msg">
> 6. Move `Error` from Core -> Utility<br class="gmail_msg">
> 7. Try to convert `ValueObject::GetSP()` from SharingPtr to `std::shared_ptr`, then delete `SharingPtr`.<br class="gmail_msg">
<br class="gmail_msg">
The problem SharingPtr is solving is that the value objects form a cluster: the parent value object (representing some structure say) and any of it's children (the subelement or the subelement of the subelement...) that have been realized by the ChildAtIndex, ChildByPath, and Co. calls.  And the way the value objects work, the whole cluster has to stay alive as long as any of the children are alive.  That's because everybody just knows where they are in their parent (as they should since they all can move around.)  So you need them all for jobs like recomputing values when the stop ID changes.   But users are not (and shouldn't be) required to manually hold onto any more than the element they care about, which may very well be a deep child.  SharingPtr manages this cluster and makes sure it stays alive as long as any members of the cluster are alive.<br class="gmail_msg">
<br class="gmail_msg">
I have no particular stake in how this is done, and if there's something clever in llvm that can do the same job, I'm all for that.  But you can't replace it with a std::shared_ptr, that won't work.<br class="gmail_msg">
<br class="gmail_msg">
Jim<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
> 8. Move `ModuleCache` from Utility -> Target<br class="gmail_msg">
><br class="gmail_msg">
> Finally, once all of those things are done, we can begin breaking up the `lldb-private.h`, and `lldb-enumerations.h`, etc header files and moving the enumerations to more appropriate locations, which will finally break this up.<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> <a href="https://reviews.llvm.org/D29359" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D29359</a><br class="gmail_msg">
><br class="gmail_msg">
> Files:<br class="gmail_msg">
>  lldb/include/lldb/Utility/ConvertEnum.h<br class="gmail_msg">
>  lldb/include/lldb/Utility/PriorityPointerPair.h<br class="gmail_msg">
>  lldb/include/lldb/Utility/Utils.h<br class="gmail_msg">
>  lldb/include/lldb/lldb-private-enumerations.h<br class="gmail_msg">
>  lldb/source/Commands/CommandObjectPlatform.cpp<br class="gmail_msg">
>  lldb/source/Core/Section.cpp<br class="gmail_msg">
>  lldb/source/Interpreter/OptionGroupArchitecture.cpp<br class="gmail_msg">
>  lldb/source/Interpreter/OptionGroupFormat.cpp<br class="gmail_msg">
>  lldb/source/Interpreter/OptionGroupOutputFile.cpp<br class="gmail_msg">
>  lldb/source/Interpreter/OptionGroupPlatform.cpp<br class="gmail_msg">
>  lldb/source/Interpreter/OptionGroupUUID.cpp<br class="gmail_msg">
>  lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp<br class="gmail_msg">
>  lldb/source/Interpreter/OptionGroupVariable.cpp<br class="gmail_msg">
>  lldb/source/Interpreter/OptionGroupWatchpoint.cpp<br class="gmail_msg">
>  lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp<br class="gmail_msg">
>  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp<br class="gmail_msg">
>  lldb/source/Target/Platform.cpp<br class="gmail_msg">
>  lldb/source/Target/ThreadList.cpp<br class="gmail_msg">
>  lldb/source/Target/ThreadPlan.cpp<br class="gmail_msg">
>  lldb/source/Utility/ARM64_DWARF_Registers.cpp<br class="gmail_msg">
>  lldb/source/Utility/ARM64_DWARF_Registers.h<br class="gmail_msg">
>  lldb/source/Utility/ARM_DWARF_Registers.cpp<br class="gmail_msg">
>  lldb/source/Utility/ARM_DWARF_Registers.h<br class="gmail_msg">
>  lldb/source/Utility/CMakeLists.txt<br class="gmail_msg">
>  lldb/source/Utility/ConvertEnum.cpp<br class="gmail_msg">
><br class="gmail_msg">
> <D29359.86516.patch>_______________________________________________<br class="gmail_msg">
> lldb-commits mailing list<br class="gmail_msg">
> <a href="mailto:lldb-commits@lists.llvm.org" class="gmail_msg" target="_blank">lldb-commits@lists.llvm.org</a><br class="gmail_msg">
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div>