44 lines · cpp
1// Test without serialization:2// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++20 \3// RUN: -ast-dump | FileCheck %s4//5// Test with serialization:6// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -std=c++20 -emit-pch -o %t %s7// RUN: %clang_cc1 -x c++ -triple x86_64-apple-darwin9 -std=c++20 -include-pch %t \8// RUN: -ast-dump-all /dev/null \9// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \10// RUN: | FileCheck %s11 12#include "Inputs/std-coroutine.h"13 14using namespace std;15 16struct A {17 bool await_ready();18 void await_resume();19 template <typename F>20 void await_suspend(F);21};22 23struct coro_t {24 struct promise_type {25 coro_t get_return_object();26 suspend_never initial_suspend();27 suspend_never final_suspend() noexcept;28 void return_void();29 static void unhandled_exception();30 };31};32 33// {{0x[0-9a-fA-F]+}} <line:[[@LINE+1]]:1, col:36>34// CHECK-LABEL: FunctionDecl {{.*}} f 'coro_t (int)'35coro_t f(int n) {36 A a{};37 // CHECK: CoawaitExpr {{0x[0-9a-fA-F]+}} <col:3, col:12>38 // CHECK-NEXT: DeclRefExpr {{0x[0-9a-fA-F]+}} <col:12>39 // CHECK-NEXT: DeclRefExpr {{0x[0-9a-fA-F]+}} <col:12>40 // CHECK-NEXT: CXXMemberCallExpr {{0x[0-9a-fA-F]+}} <col:12>41 // CHECK-NEXT: MemberExpr {{0x[0-9a-fA-F]+}} <col:12>42 co_await a;43}44