[clang] 9dddb3d - [AST] Mark the fallthrough coreturn statement implicit. (#77465)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 24 03:11:04 PST 2024


Author: Haojian Wu
Date: 2024-01-24T12:11:00+01:00
New Revision: 9dddb3d5f3bf323b7b7f8281bb848731f69fddfa

URL: https://github.com/llvm/llvm-project/commit/9dddb3d5f3bf323b7b7f8281bb848731f69fddfa
DIFF: https://github.com/llvm/llvm-project/commit/9dddb3d5f3bf323b7b7f8281bb848731f69fddfa.diff

LOG: [AST] Mark the fallthrough coreturn statement implicit. (#77465)

This is a followup of #77311.

Added: 
    

Modified: 
    clang/lib/Sema/SemaCoroutine.cpp
    clang/test/AST/ast-dump-coroutine.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index 4e600fd29ee7395..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*/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


        


More information about the cfe-commits mailing list