[clang] [AST] Mark the fallthrough coreturn statement implicit. (PR #77465)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 24 02:52:49 PST 2024
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/77465
>From 781201c5c0a526821f51ce6aa0e2c972a9f5f51f 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 1/2] [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 4e600fd29ee7395..a171ab579cba838 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -1748,7 +1748,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 5e7736300f9fee8..8741c7b35b155aa 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
>From 7ac002e371e2b3c089c5f7f771da9064481f551b Mon Sep 17 00:00:00 2001
From: Haojian Wu <hokein.wu at gmail.com>
Date: Wed, 24 Jan 2024 11:51:53 +0100
Subject: [PATCH 2/2] Address a comment.
---
clang/lib/Sema/SemaCoroutine.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index a171ab579cba838..a969b9383563b22 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -1748,7 +1748,7 @@ bool CoroutineStmtBuilder::makeOnFallthrough() {
return false;
} else if (HasRVoid) {
Fallthrough = S.BuildCoreturnStmt(FD.getLocation(), nullptr,
- /*IsImplicit*/true);
+ /*IsImplicit=*/true);
Fallthrough = S.ActOnFinishFullStmt(Fallthrough.get());
if (Fallthrough.isInvalid())
return false;
More information about the cfe-commits
mailing list