rjmccall added a comment.

Right. C structs can require more than just `memcpy` to copy in several 
different situations (all involving language extensions), but it doesn't 
require Sema to be involved: it doesn't introduce uses of user declarations, 
and the compiler can figure out the work it needs to do with a straightforward 
recursive inspection of the field types, so IRGen just synthesizes those 
operations automatically when requested.  Neither condition holds in C++, so 
Sema has to synthesize a copy expression which resolves the correct copy 
constructor and sets up any extra arguments it might require, triggering 
appropriate diagnostics and/or tracking of used decls.  There are a bunch of 
places we do that for various language extensions already, including a bunch in 
the OpenMP code, and we usually just store the expression in the associated AST 
node.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129008

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to