[Lldb-commits] [PATCH] D67589: Fix crash on SBCommandReturnObject & assignment

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 20 04:50:10 PDT 2019


labath added a comment.

In D67589#1674640 <https://reviews.llvm.org/D67589#1674640>, @jankratochvil wrote:

> Maybe http://lldb.llvm.org/resources/sbapi.html could say that and it would be much more clear.


That's probably a good idea, though I would still keep the list of restrictions spelled out as ABI can be broken in a lot of subtle and unobvious ways (at least to a person who has never tried to maintain a stable abi).

> 
> 
>>   lldb_private::CommandReturnObjectImpl {
>>     bool owned;
>>     std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_up;
>>   };
> 
> Is this a request to rework this patch this way? If so isn't it safer / more clear to do it rather this way?
> 
>   lldb_private::CommandReturnObjectImpl {
>     bool owned;
>     lldb_private::CommandReturnObject *m_opaque_ptr;
>     ~CommandReturnObjectImpl() { if (owned) delete m_opaque_ptr; }
>   };

I think I would like that better than the swap trick. Since you're now inside a pimpl, you can replace the two members with a llvm::PointerIntPair, if you are so inclined.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67589/new/

https://reviews.llvm.org/D67589





More information about the lldb-commits mailing list