[cfe-dev] [PATCH] Add APValue::swap

David Blaikie dblaikie at gmail.com
Thu Mar 8 14:54:07 PST 2012


On Thu, Mar 8, 2012 at 2:46 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Mar 8, 2012, at 10:45 AM, Howard Hinnant wrote:
>
>> On Mar 8, 2012, at 1:39 PM, Daniel Dunbar wrote:
>>
>>> I wanted to make the copy assignment operator private to encourage
>>> callers to see if they could use swap instead.
>>>
>>> My motivation here seems confused though, per subsequent discussion.
>>
>> I think you're just ahead of your time.  Sounds like you're trying to encourage C++11 move assignment. :-) (which I think would be a very good idea, but requires commitment to using C++11)
>
> I think that it would be completely reasonable (maybe even, "insanely great"?) to put move constructors and assignment operators into llvm & clang if they help performance and are *optional* and ifdef'd on compiler support.
>
> That would just mean that people with c++'11 compilers can get better build times, but that we remain compatible with older compilers.

Usually we have to/have worked around the cases (you know, the usual
"don't return big things by value") - the most common things that
would benefit would be stuff that this already happens for (eg:
std::string). Anyone know of good candidates that we wouldn't
reasonably fix for the 98 case by removing the copies?

- David




More information about the cfe-dev mailing list