[PATCH] D123345: Treat `std::move`, `forward`, and `move_if_noexcept` as builtins.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 11 09:14:29 PDT 2022


On Mon, Apr 11, 2022 at 10:50 AM Joerg Sonnenberger via Phabricator
<reviews at reviews.llvm.org> wrote:
>
> joerg added a comment.
>
> The patch contains at least one user visible change that would be quite surprising: it is no longer possible to intentionally set a break point on `std::move`.

Thank you, that is a really good point. It would be a surprise to set
a breakpoint on the code I can see in debug mode (-O0 -g) and never
hit the breakpoint.

> Thinking more about it, what about a slightly different implementation strategy? Provide a compiler built-in `__builtin_std_move`. If it is present, libc++ can alias it into `namespace std` using regular C++. Much of the name-matching and argument checking in various places disappears. The check to skip template instantiation can be done the same way. Over-all, it should be much less intrusive with the same performance benefits for an built-in-aware STL. It completely side-steps the question of ignoring the actual implementation `of std::move` in the source, because there is none.

This is a pretty neat idea that seems worth exploring; it certainly
makes me more comfortable than adding comment line options that
suggest users can reliably modify things in namespace std. Thanks for
the suggestion!

~Aaron

>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D123345/new/
>
> https://reviews.llvm.org/D123345
>


More information about the cfe-commits mailing list