CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
68 lines
2.3 KiB
C++
68 lines
2.3 KiB
C++
// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -std=c++20 \
|
|
// RUN: -ast-dump -ast-dump-filter test | FileCheck %s
|
|
|
|
#include "Inputs/std-coroutine.h"
|
|
|
|
using namespace std;
|
|
|
|
struct Task {
|
|
struct promise_type {
|
|
std::suspend_always initial_suspend() { return {}; }
|
|
Task get_return_object() {
|
|
return std::coroutine_handle<promise_type>::from_promise(*this);
|
|
}
|
|
std::suspend_always final_suspend() noexcept { return {}; }
|
|
std::suspend_always return_void() { return {}; }
|
|
void unhandled_exception() {}
|
|
|
|
auto await_transform(int s) {
|
|
struct awaiter {
|
|
promise_type *promise;
|
|
bool await_ready() { return true; }
|
|
int await_resume() { return 1; }
|
|
void await_suspend(std::coroutine_handle<>) {}
|
|
};
|
|
|
|
return awaiter{this};
|
|
}
|
|
};
|
|
|
|
Task(std::coroutine_handle<promise_type> promise);
|
|
|
|
std::coroutine_handle<promise_type> handle;
|
|
};
|
|
|
|
Task test() {
|
|
co_await 1;
|
|
// Writen souce code, verify no implicit bit for the co_await expr.
|
|
// CHECK: CompoundStmt {{.*}}
|
|
// CHECK-NEXT: | `-ExprWithCleanups {{.*}} 'int'
|
|
// CHECK-NEXT: | `-CoawaitExpr {{.*}} 'int'{{$}}
|
|
// CHECK-NEXT: | |-IntegerLiteral {{.*}} <col:12> 'int' 1
|
|
// CHECK-NEXT: | |-MaterializeTemporaryExpr {{.*}} 'awaiter'
|
|
// CHECK-NEXT: | | `-CXXMemberCallExpr {{.*}} 'awaiter'
|
|
// CHECK-NEXT: | | |-MemberExpr {{.*}} .await_transform
|
|
}
|
|
// Verify the implicit AST nodes for coroutines.
|
|
// CHECK: |-DeclStmt {{.*}}
|
|
// CHECK-NEXT: | `-VarDecl {{.*}} implicit used __promise
|
|
// CHECK-NEXT: | `-CXXConstructExpr {{.*}}
|
|
// CHECK-NEXT: |-ExprWithCleanups {{.*}} 'void'
|
|
// CHECK-NEXT: | `-CoawaitExpr {{.*}} 'void' implicit
|
|
// CHECK-NEXT: |-CXXMemberCallExpr {{.*}} 'std::suspend_always'
|
|
// CHECK-NEXT: | | `-MemberExpr {{.*}} .initial_suspend
|
|
// ...
|
|
// CHECK: CoreturnStmt {{.*}} <col:6> implicit
|
|
|
|
Task test2() {
|
|
// Writen souce code, verify no implicit bit for the co_return expr.
|
|
// CHECK: CompoundStmt {{.*}}
|
|
// CHECK-NEXT: | `-CoreturnStmt {{.*}} <line:{{.*}}:{{.*}}>{{$}}
|
|
co_return;
|
|
}
|
|
// Verify the implicit AST nodes for coroutines.
|
|
// CHECK: |-DeclStmt {{.*}}
|
|
// CHECK-NEXT: | `-VarDecl {{.*}} implicit used __promise
|
|
// ...
|
|
// CHECK: CoreturnStmt {{.*}} <col:6> implicit
|