[Lldb-commits] [lldb] [lldb] Make SBCommandReturnObjectImpl copies owned (PR #230196)
Will Hawkins via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 14 03:11:03 PDT 2026
================
@@ -22,24 +22,26 @@
#include "lldb/Utility/Instrumentation.h"
#include "lldb/Utility/Status.h"
#include "lldb/lldb-forward.h"
+#include <utility>
using namespace lldb;
using namespace lldb_private;
SBCommandReturnObjectImpl::SBCommandReturnObjectImpl()
- : m_ptr(new CommandReturnObject(false)) {}
+ : m_ptr(new CommandReturnObject(false)), m_owned(true) {}
SBCommandReturnObjectImpl::SBCommandReturnObjectImpl(CommandReturnObject &ref)
: m_ptr(&ref), m_owned(false) {}
SBCommandReturnObjectImpl::SBCommandReturnObjectImpl(
const SBCommandReturnObjectImpl &rhs)
- : m_ptr(new CommandReturnObject(*rhs.m_ptr)), m_owned(rhs.m_owned) {}
+ : m_ptr(new CommandReturnObject(*rhs.m_ptr)), m_owned(true) {}
SBCommandReturnObjectImpl &
SBCommandReturnObjectImpl::operator=(const SBCommandReturnObjectImpl &rhs) {
SBCommandReturnObjectImpl copy(rhs);
- std::swap(*this, copy);
+ std::swap(m_ptr, copy.m_ptr);
+ std::swap(m_owned, copy.m_owned);
----------------
hawkinsw wrote:
Thank you for not mocking my suggestion!
Great job finding and fixing this issue!
https://github.com/llvm/llvm-project/pull/230196
More information about the lldb-commits
mailing list