[Lldb-commits] [lldb] [lldb] Return *const* UnwindPlan pointers from FuncUnwinders (PR #133247)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 31 02:42:49 PDT 2025


================
@@ -36,18 +36,19 @@ class FuncUnwinders {
 
   ~FuncUnwinders();
 
-  lldb::UnwindPlanSP GetUnwindPlanAtCallSite(Target &target, Thread &thread);
+  std::shared_ptr<const UnwindPlan> GetUnwindPlanAtCallSite(Target &target,
----------------
labath wrote:

Currently we need them, because the unwind plans are (sometimes) stored in a shared pointer while they are being constructed. That could be avoided because we don't really need the shared ownership at that point (they could be a unique_ptr or a value). However, I'm not particularly thrilled with the idea of repurposing UnwindPlanSP for this, as I think that would be surprising -- there's nothing in that name that indicates this is a const pointer, and I think it's important to see that.

One idea I have had that could solve this (but have never found the time to propose) is to replace the individual FoobarSP typedefs with a `SP = std::shared_ptr<T>` template alias. That would let us write `SP<const Foobar>` in exactly the places which need it; and it might also help with the hypothetical migration to the llvm naming convention (frees up `FoobarSP` as a member name)

https://github.com/llvm/llvm-project/pull/133247


More information about the lldb-commits mailing list