[PATCH] D99005: [clang] WIP: Implement P2266

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 21 17:56:42 PDT 2021


mizvekov updated this revision to Diff 332184.
mizvekov added a comment.

Changed:

- Implemented co_return as per Aaron's suggestion.
- Imported coroutine tests from D68845 <https://reviews.llvm.org/D68845>.
- Test tags shortened: cxxYY_cxxZZ means every version from YY to ZZ, instead of cxxAA_BB_CC_DD.
- Existing test on decltype(auto) updated to also run on c++2b.
- Change one of the test cases to just instantiate the relevant template, as per Arthur.

Still missing:
Making this run on all tests:

- A lot of tests are running in only one old standard. Changing everything here would generate too much noise.
- Some simplifications:
  - Aggregate common code for adding the implicit cast.
  - PerformMoveOrCopyInitialization can be changed to PerformCopyInitialization in the cases where AllowNRVO is false.
  - Can easily skip adding the implicit cast if expr was already a xvalue.
  - getCopyElisionCandidate needs refactoring IMHO. It is doing too much in one function, and this patch makes it worse. There are a lot of calls to it sprinkled around in the same sequence. Some problems:
    - On the current code, we want two things out of it: "Can we perform copy elision" AND "Can we perform implicit move". We end up calling it twice for that, with two parameters, instead of once returning both answers.
    - With this patch, now we need to call it even before we have the function return type available, then decide this type based on it, and then call it again to figure out if we can do copy elision. I will try to propose some way to improve that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99005

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaCoroutine.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-14.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp
  clang/test/CXX/special/class.copy/p33-0x.cpp
  clang/test/SemaCXX/coroutine-rvo.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99005.332184.patch
Type: text/x-patch
Size: 31992 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210322/bfeda051/attachment-0001.bin>


More information about the cfe-commits mailing list