labath added a comment. I'd like to remind everyone of a not-very-widely-known, but incredibly nifty feature of std::shared_ptr, called "aliasing". It allows one to create a shared_ptr which points to one object, but deletes a completely different object when it goes out of scope. It works like so:
std::shared_ptr<A> a = std::make_shared<A>(...); // or whatever std::shared_ptr<B> b(a, getB(a)); // will point to a B, but call `delete A` when it goes out of scope The model use case is when the first object is a subobject (field) of the second one (so we'd have `struct A { B b; ... }; and `getB(a)` would be `&a->b`), but that is not a a requirement. B can be a completely arbitrary object -- the only requirement is that B remains live for as long as A is around. Now, I don't understand this code well enough to say whether that could/should be used here, but the (few) parts which I did understand led me to think that there are some subobjects (in the broadest sense of the word) being passed around, and so I have a feeling we should at least consider this option -- it seems like it would be better to pass around objects with explicit ownership semantics instead of raw pointers. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117139/new/ https://reviews.llvm.org/D117139 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits