r217474 - Unique_ptrify PPCallbacks ownership.

Kim Gräsman kim.grasman at gmail.com
Thu Sep 11 08:57:54 PDT 2014


On Thu, Sep 11, 2014 at 5:18 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
> On Sep 10, 2014 10:27 PM, "Craig Topper" <craig.topper at gmail.com> wrote:
>>
>> You'll notice half the places in clang that called addPPCallbacks ended up
>> with a cast to std::unique_ptr in the call to addPPCallbacks for the same
>> reason.
>
> If that api takes ownership, I'd still vote for it to take by unique_ptr
> even if many callers will still want to refer to the object later. Otherwise
> its hard to tell who's responsible for cleanup.

I agree. But it ultimately feels a little weird to me that
addPPCallbacks takes ownership to begin with.

I'm almost tempted to suggest a shared_ptr here.



More information about the cfe-commits mailing list