[PATCH] D99893: [WIP] Replace std::forward & std::move by cast expressions during Sema

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 6 14:40:56 PDT 2021


cor3ntin added a comment.

In D99893#2672258 <https://reviews.llvm.org/D99893#2672258>, @rjmccall wrote:

> Our builtin logic is capable of recognizing user declarations as builtins without any sort of explicit annotation in source.  That's how we recognize C library builtins, for example.  As Richard points out, that logic isn't really set up to do the right thing for namespaced declarations (or template ones, for that matter), but that seems fixable.
>
> The namespace issue might be annoying because of the inline namespaces that some standard libraries used for ABI versioning.

I managed to make a somewhat generic mechanism to mark functions declared in the namespace std ( and I do think we want there to be a declaration in the header always) as built-ins.
Currently it's using the number of parameters as a filter - which I think is reasonable ( the issue as Richard pointed out is that `std::move` is overloaded  with the algorithm version).

I'm now struggling to handle code generation and constant evaluation, but hopefully I will find a way to get there.

This would solve some of the issues (perfect code-gen / no body instantiation), but the declarations are still instantiated of course.
And I have a few folks asking me whether I could get rid of it. Unfortunately, I think the goals of preserving the AST as is today and getting rid of these template instantiations are contradictory.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99893/new/

https://reviews.llvm.org/D99893



More information about the cfe-commits mailing list