[Coroutines] Implement fix for cwg2563 issue and enable RVO under certain conditions
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Thu, 9 Mar 2023 00:00:02 +0000 (16:00 -0800)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Wed, 22 Mar 2023 04:42:31 +0000 (21:42 -0700)
commitfa0d4e1f12a3f69dd0afb07c0928c867ab921537
tree0c8bb04a782b963c28e23dd0dfabfb9970eea666
parent43f5085fa80f716acf93870618b1d93ec85c1d01
[Coroutines] Implement fix for cwg2563 issue and enable RVO under certain conditions

- The cwg2563 issue is fixed by delaying GRO initialization only when the types
  mismatch between GRO and function return.
- When the types match directly initialize, which indirectly enables RVO to
  kick in, partially restores behavior introduced in
  https://reviews.llvm.org/D117087.
- Add entry to release notes.

Background:
https://github.com/llvm/llvm-project/issues/56532
https://cplusplus.github.io/CWG/issues/2563.html
https://github.com/cplusplus/papers/issues/1414

Differential Revision: https://reviews.llvm.org/D145641
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/StmtCXX.h
clang/lib/CodeGen/CGCoroutine.cpp
clang/lib/Sema/SemaCoroutine.cpp
clang/lib/Sema/TreeTransform.h
clang/test/CodeGenCoroutines/coro-gro.cpp
clang/test/SemaCXX/coroutine-no-move-ctor.cpp