[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.

Gor Nishanov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 17 16:38:28 PST 2017


GorNishanov created this revision.
Herald added a subscriber: mehdi_amini.

Sema::CheckCompletedCoroutineBody was growing unwieldy with building all of the substatements. Also, constructors for CoroutineBodyStmt had way too many parameters.

Instead,  CoroutineBodyStmt now defines CtorArgs structure with all of the required construction parameters.
CheckCompleteCoroutineBody delegates construction of individual substatements to short functions one per each substatement.

Also, added a drive-by fix of initializing CoroutinePromise to nullptr in ScopeInfo.h.
And addressed the FIXME that wanted to tail allocate extra room at the end of the CoroutineBodyStmt to hold parameter move expressions. (The comment was longer that the code that implemented tail allocation).


https://reviews.llvm.org/D28835

Files:
  include/clang/AST/StmtCXX.h
  include/clang/Sema/ScopeInfo.h
  lib/AST/StmtCXX.cpp
  lib/Sema/SemaCoroutine.cpp
  test/SemaCXX/coroutines.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28835.84775.patch
Type: text/x-patch
Size: 17275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170118/8b845d47/attachment-0001.bin>


More information about the cfe-commits mailing list