Clang Project

clang_source_code/test/AST/coroutine-source-location-crash.cpp
1// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts \
2// RUN:    -fsyntax-only -ast-dump | FileCheck %s
3#include "Inputs/std-coroutine.h"
4
5using namespace std::experimental;
6
7struct A {
8  bool await_ready();
9  void await_resume();
10  template <typename F>
11  void await_suspend(F);
12};
13
14struct coro_t {
15  struct promise_type {
16    coro_t get_return_object();
17    suspend_never initial_suspend();
18    suspend_never final_suspend();
19    void return_void();
20    static void unhandled_exception();
21  };
22};
23
24// {{0x[0-9a-fA-F]+}} <line:[[@LINE+1]]:1, col:36>
25// CHECK-LABEL: FunctionDecl {{.*}} f 'coro_t (int)'
26coro_t f(int n) {
27  A a{};
28  // CHECK: CoawaitExpr {{0x[0-9a-fA-F]+}} <col:3, col:12>
29  // CHECK-NEXT: DeclRefExpr {{0x[0-9a-fA-F]+}} <col:12>
30  // CHECK-NEXT: CXXMemberCallExpr {{0x[0-9a-fA-F]+}} <col:12>
31  // CHECK-NEXT: MemberExpr {{0x[0-9a-fA-F]+}} <col:12>
32  co_await a;
33}
34