Hi Craig, On Thu, Sep 11, 2014 at 7:19 AM, Craig Topper <[email protected]> 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. But given that I find that kind of ugly I think I'll revert the > interface part of the change.
D'oh, I see now. Wrapping the raw pointer in a std::unique_ptr and transferring ownership won't move the raw pointer, only the smart pointer. >> IwyuPreprocessorInfo* const preprocessor_consumer >> = new IwyuPreprocessorInfo(); >> compiler.getPreprocessor().addPPCallbacks(preprocessor_consumer); // >> here >> compiler.getPreprocessor().addCommentHandler(preprocessor_consumer); // >> here >> >> VisitorState* const visitor_state >> = new VisitorState(&compiler, *preprocessor_consumer); // and here I mistakenly thought that unique_ptr disabled the ability to share the pointer entirely, but I could just do: IwyuPreprocessorInfo* preprocessor_consumer = new IwyuPreprocessorInfo(); compiler.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(preprocessor_consumer)); compiler.getPreprocessor().addCommentHandler(preprocessor_consumer); VisitorState* const visitor_state = new VisitorState(&compiler, *preprocessor_consumer); My mistake for misreading the impact of this change, sorry about the noise. - Kim _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
