[clang] [AST] Mark the fallthrough coreturn statement implicit. (PR #77465)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 9 05:11:27 PST 2024
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/77465
None
>From 17afb4cb0e43ae77268ad406cd2510af69756fae Mon Sep 17 00:00:00 2001
From: Haojian Wu <hokein.wu at gmail.com>
Date: Tue, 9 Jan 2024 14:02:01 +0100
Subject: [PATCH] [AST] Mark the fallthrough coreturn statement implicit.
---
clang/lib/Sema/SemaCoroutine.cpp | 2 +-
clang/test/AST/ast-dump-coroutine.cpp | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index bee80db8d166a6..86afa9b719db69 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -1743,7 +1743,7 @@ bool CoroutineStmtBuilder::makeOnFallthrough() {
return false;
} else if (HasRVoid) {
Fallthrough = S.BuildCoreturnStmt(FD.getLocation(), nullptr,
- /*IsImplicit*/false);
+ /*IsImplicit*/true);
Fallthrough = S.ActOnFinishFullStmt(Fallthrough.get());
if (Fallthrough.isInvalid())
return false;
diff --git a/clang/test/AST/ast-dump-coroutine.cpp b/clang/test/AST/ast-dump-coroutine.cpp
index 5e7736300f9fee..8741c7b35b155a 100644
--- a/clang/test/AST/ast-dump-coroutine.cpp
+++ b/clang/test/AST/ast-dump-coroutine.cpp
@@ -52,8 +52,7 @@ Task test() {
// CHECK-NEXT: |-CXXMemberCallExpr {{.*}} 'std::suspend_always'
// CHECK-NEXT: | | `-MemberExpr {{.*}} .initial_suspend
// ...
-// FIXME: the CoreturnStmt should be marked as implicit
-// CHECK: CoreturnStmt {{.*}} <col:6>{{$}}
+// CHECK: CoreturnStmt {{.*}} <col:6> implicit
Task test2() {
// Writen souce code, verify no implicit bit for the co_return expr.
@@ -65,5 +64,4 @@ Task test2() {
// CHECK: |-DeclStmt {{.*}}
// CHECK-NEXT: | `-VarDecl {{.*}} implicit used __promise
// ...
-// FIXME: the CoreturnStmt should be marked as implicit
-// CHECK: CoreturnStmt {{.*}} <col:6>{{$}}
+// CHECK: CoreturnStmt {{.*}} <col:6> implicit
More information about the cfe-commits
mailing list