[clang][pr55896]:co_yield/co_await thread-safety
authorNathan Sidwell <nathan@acm.org>
Mon, 6 Jun 2022 12:27:10 +0000 (05:27 -0700)
committerNathan Sidwell <nathan@acm.org>
Thu, 9 Jun 2022 11:42:10 +0000 (04:42 -0700)
commit65b34b78f8dafbfd97836af3165e73c5b316c6b5
tree7e5aab8fc429ca1e53533675c53ad4f08163d982
parent982053e85e657fa132bf92681ba4c8eaa616b48b
[clang][pr55896]:co_yield/co_await thread-safety

co_await and co_yield are represented by (classes derived from)
CoroutineSuspendExpr.  That has a number of child nodes, not all of
which are used for code-generation.  In particular the operand is
represented multiple times, and, like the problem with co_return
(55406) it must only be emitted in the CFG exactly once.  The operand
also appears inside OpaqueValueExprs, but that's ok.

This adds a visitor for SuspendExprs to emit the required children in
the correct order.  Note that this CFG is pre-coro xform.  We don't
have initial or final suspend points.

Reviewed By: bruno

Differential Revision: https://reviews.llvm.org/D127236
clang/lib/Analysis/CFG.cpp
clang/test/SemaCXX/thread-safety-coro.cpp