[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 06:30:15 PST 2024


================
@@ -60,6 +61,45 @@ static bool isTrivialDoWhile(const CFGBlock *B, const Stmt *S) {
   return false;
 }
 
+// Check if the block starts with a coroutine statement and see if the given
+// unreachable 'S' is the substmt of the coroutine statement.
+//
+// We suppress the unreachable warning for cases where an unreachable code is
+// a substmt of the coroutine statement, becase removing it will change the
+// function semantic if this is the only coroutine statement of the coroutine.
+static bool isInCoroutineStmt(const CFGBlock *Block, const Stmt* S) {
----------------
usx95 wrote:

nit: rename `S` to `Unreachable` to avoid confusion with other variables named `S`.

https://github.com/llvm/llvm-project/pull/77454


More information about the cfe-commits mailing list