[clang] [coroutine] Suppress unreachable-code warning on coroutine statements. (PR #77454)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 2 02:52:30 PST 2024
================
@@ -33,33 +40,37 @@ task test3() {
task test4() {
abort();
- 1; // expected-warning {{code will never be executed}}
+ 1; // expected-warning {{code will never be executed}}
co_return;
}
-
task test5() {
abort();
- co_await std::suspend_never{};
+ co_await 1;
}
task test6() {
abort();
- 1; // expected-warning {{code will never be executed}}
- co_await std::suspend_never{};
+ 1; // expected-warning {{code will never be executed}}
+ co_await 3;
}
task test7() {
// coroutine statements are not considered unreachable.
- co_await std::suspend_never{};
+ co_await 1;
abort();
- co_await std::suspend_never{};
+ co_await 2;
}
task test8() {
// coroutine statements are not considered unreachable.
- // co_await std::suspend_never{};
abort();
co_return;
- 1 + 1; // expected-warning {{code will never be executed}}
+ 1 + 1; // expected-warning {{code will never be executed}}
+}
+
+task test9() {
+ abort();
+ // This warning is emit on the declaration itself, rather the coroutine substmt.
----------------
usx95 wrote:
s/emit/emitted
https://github.com/llvm/llvm-project/pull/77454
More information about the cfe-commits
mailing list