================
@@ -126,6 +127,18 @@ class ModuleSpec {
 
   lldb::DataBufferSP GetData() const { return m_data; }
 
+  Target *GetTargetPtr() {
+    auto locked = m_target.lock();
+    return locked.get();
+  }
----------------
JDevlieghere wrote:

This is inherently unsafe: once you return the pointer nothing ensures the 
refcount doesn't drop to zero and you're holding on to an invalid reference. If 
you need this, you must return a TargetSP to ensure the target remains alive 
until the shared pointer goes out of scope.

https://github.com/llvm/llvm-project/pull/160199
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to