<div dir="ltr">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. But given that I find that kind of ugly I think I'll revert the interface part of the change.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 10, 2014 at 12:13 PM, Kim Gräsman <span dir="ltr"><<a href="mailto:kim.grasman@gmail.com" target="_blank">kim.grasman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Craig,<br>
<br>
On Wed, Sep 10, 2014 at 6:53 AM, Craig Topper <<a href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>> wrote:<br>
> Author: ctopper<br>
> Date: Tue Sep  9 23:53:53 2014<br>
> New Revision: 217474<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=217474&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=217474&view=rev</a><br>
> Log:<br>
> Unique_ptrify PPCallbacks ownership.<br>
><br>
> Unique_ptr creation stil needs to be moved earlier at some of the call sites.<br>
<br>
I'm not happy with this change at all. It precludes a PPCallbacks also<br>
serving other duties. E.g. in IWYU we have:<br>
<br>
    IwyuPreprocessorInfo* const preprocessor_consumer<br>
        = new IwyuPreprocessorInfo();<br>
    compiler.getPreprocessor().addPPCallbacks(preprocessor_consumer);  // here<br>
    compiler.getPreprocessor().addCommentHandler(preprocessor_consumer);<br>
 // here<br>
<br>
    VisitorState* const visitor_state<br>
        = new VisitorState(&compiler, *preprocessor_consumer);  // and here<br>
    return std::unique_ptr<IwyuAstConsumer>(new IwyuAstConsumer(visitor_state));<br>
<br>
Our PPCallbacks impl also happens to be a comment handler, plus we<br>
want to share the data it's collected with our AST consumer.<br>
<br>
The unique_ptr completely kills this scenario, and alternative<br>
designed seem much more complex.<br>
<br>
Would you consider reverting?<br>
<br>
Thanks,<br>
- Kim<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>~Craig
</div>