[Lldb-commits] [PATCH] D58946: [SBAPI] Don't check IsValid in constructor
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 5 08:19:13 PST 2019
Sounds good, I’ll make this change before landing, unless you have further
comments?
On Tue, Mar 5, 2019 at 4:29 AM Pavel Labath via Phabricator <
reviews at reviews.llvm.org> wrote:
> labath added a comment.
>
> The copy constructors and assignment operators are very repetitive. What
> would you say to a function like
>
> template<typename T>
> void clone(std::unique_ptr<T> &dest, const std::unique_ptr<T> &src) {
> if (&dest == &src)
> return;
> if (src)
> dest = llvm::make_unique<T>(*src);
> else
> dest.reset();
> }
>
> (and a similar one for shared_ptrs)? Then both copy constructors and
> assignment operators could be just implemented as `clone(m_whatever,
> rhs.m_whatever);`. (Assuming we don't care about pessimizing the
> self-assignment case this could even be `m_whatever =
> clone(rhs.m_whatever);`)
>
>
> Repository:
> rLLDB LLDB
>
> CHANGES SINCE LAST ACTION
> https://reviews.llvm.org/D58946/new/
>
> https://reviews.llvm.org/D58946
>
>
>
> --
Sent from my iPhone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190305/f139e032/attachment.html>
More information about the lldb-commits
mailing list