[all-commits] [llvm/llvm-project] a73baf: [coroutine] Suppress unreachable-code warning on c...
Haojian Wu via All-commits
all-commits at lists.llvm.org
Sun Feb 4 23:55:39 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a73baf620b8374805b7e927cc79cc157a30e0ac8
https://github.com/llvm/llvm-project/commit/a73baf620b8374805b7e927cc79cc157a30e0ac8
Author: Haojian Wu <hokein.wu at gmail.com>
Date: 2024-02-05 (Mon, 05 Feb 2024)
Changed paths:
M clang/lib/Analysis/ReachableCode.cpp
A clang/test/SemaCXX/coroutine-unreachable-warning.cpp
Log Message:
-----------
[coroutine] Suppress unreachable-code warning on coroutine statements. (#77454)
This fixes #69219.
Consider an example:
```
CoTask my_coroutine() {
std::abort();
co_return 1; // unreachable code warning.
}
```
Clang emits a CFG-based unreachable warning on the `co_return` statement
(precisely the `1` subexpr). If we remove this statement, the program
semantic is changed (my_coroutine is not a coroutine anymore).
This patch fixes this issue by never considering coroutine statements as
dead statements.
More information about the All-commits
mailing list