<div dir="ltr"><div>No objections here. I'd be glad to see this go in. :)</div><div><br></div><div>- Lang.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 18, 2014 at 4:30 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sounds like we've got sufficient amount of momentum here for Dave to<br>
go ahead and recommit. Any last objections?<br>
<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Fri, Jul 18, 2014 at 1:35 PM, Eli Bendersky <<a href="mailto:eliben@google.com">eliben@google.com</a>> wrote:<br>
><br>
><br>
><br>
> On Fri, Jul 18, 2014 at 12:06 PM, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:<br>
>><br>
>> I don't have much to add here besides +1. I think using std::unique_ptr<br>
>> even for create* functions/methods is the right way to go.<br>
><br>
><br>
> +1 smart pointers here are a win in terms of safety and self-documentation.<br>
> I don't see why create* factories should be treated differently.<br>
><br>
> Eli<br>
><br>
><br>
><br>
>><br>
>> Reid's point about an abstraction penalty is interesting, but I don't<br>
>> think we do ownership transfers often enough to actually see a performance<br>
>> hit. (Of course, in the non-transferring case we'd just pass the pointer,<br>
>> not a 'const std::unique_ptr &' or anything.)<br>
>><br>
>> Jordan<br>
>><br>
>><br>
>> On Jul 17, 2014, at 16:21 , David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
>><br>
>> > There seems to be some uncertainty about the use of smart pointers<br>
>> > (previously OwningPtr, now std::unique_ptr and std::shared_ptr<br>
>> > predominantly) in the LLVM project as a whole, so here's a thread to<br>
>> > discuss/clarify/etc the project preferences/direction with regard to<br>
>> > smart pointer usage.<br>
>> ><br>
>> > For some context, see discussions in LLVM r212403 and Clang r213307.<br>
>> ><br>
>> > The basic question here seems to be whether smart pointer ownership is<br>
>> > a direction we want to take the LLVM project in general.<br>
>> ><br>
>> > I've seen others contribute and have myself contributed many patches<br>
>> > moving towards smart pointer ownership (both in the pre-C++11 days of<br>
>> > OwningPtr, and much moreso in the post-C++11 world with<br>
>> > std::unique_ptr and std::shared_ptr being usable inside containers, as<br>
>> > return values, etc, allowing many more opportunities).<br>
>> ><br>
>> > std::unique_ptr's been used in LLD as far back as r153620.<br>
>> > std::unique_ptr appeared in LLVM shortly after the C++11 switch with<br>
>> > Ahmed's work to migrate the project from OwningPtr to std::unique_ptr<br>
>> > (starting with r202609 and ending with r211259). Originally OwningPtr<br>
>> > was added in r45261.<br>
>> > Something in the order of 60 changes across clang and LLVM mention<br>
>> > unique_ptr in their subject and migrate various APIs to use unique_ptr<br>
>> > for ownership. Many of which remove uses of explicit delete or helpers<br>
>> > like DeleteContainerPointers (and removing explicit dtors in many of<br>
>> > those cases).<br>
>> ><br>
>> > Are people OK with/prefer the use of owning smart pointers in APIs?<br>
>> > Are there places where you've found them to be too noisy/burdensome<br>
>> > and would rather use raw pointers or some other abstraction? Would you<br>
>> > prefer pre-commit review of such changes to adequately consider<br>
>> > alternatives (such as?)?<br>
>> ><br>
>> > Thanks,<br>
>> > - David<br>
>> > _______________________________________________<br>
>> > cfe-dev mailing list<br>
>> > <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
>> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
>><br>
>> _______________________________________________<br>
>> cfe-dev mailing list<br>
>> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>