[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCoroutines / coro-dest-slot-exp-namespace.cpp
blob14be9a1d03601a7be21505e1a2be8a1aa493f220
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -emit-llvm %s -o - -disable-llvm-passes | FileCheck %s
3 #include "Inputs/coroutine-exp-namespace.h"
5 using namespace std::experimental;
7 struct coro {
8 struct promise_type {
9 coro get_return_object();
10 suspend_always initial_suspend();
11 suspend_never final_suspend() noexcept;
12 void return_void();
13 static void unhandled_exception();
17 extern "C" coro f(int) { co_return; }
18 // Verify that cleanup.dest.slot is eliminated in a coroutine.
19 // CHECK-LABEL: f(
20 // CHECK: %[[INIT_SUSPEND:.+]] = call i8 @llvm.coro.suspend(
21 // CHECK-NEXT: switch i8 %[[INIT_SUSPEND]], label
22 // CHECK-NEXT: i8 0, label %[[INIT_READY:.+]]
23 // CHECK-NEXT: i8 1, label %[[INIT_CLEANUP:.+]]
24 // CHECK-NEXT: ]
25 // CHECK: %[[CLEANUP_DEST0:.+]] = phi i32 [ 0, %[[INIT_READY]] ], [ 2, %[[INIT_CLEANUP]] ]
27 // CHECK: %[[FINAL_SUSPEND:.+]] = call i8 @llvm.coro.suspend(
28 // CHECK-NEXT: switch i8 %{{.*}}, label %coro.ret [
29 // CHECK-NEXT: i8 0, label %[[FINAL_READY:.+]]
30 // CHECK-NEXT: i8 1, label %[[FINAL_CLEANUP:.+]]
31 // CHECK-NEXT: ]
33 // CHECK: call void @_ZNSt12experimental13coroutines_v113suspend_never12await_resumeEv(
34 // CHECK: %[[CLEANUP_DEST1:.+]] = phi i32 [ 0, %[[FINAL_READY]] ], [ 2, %[[FINAL_CLEANUP]] ]
35 // CHECK: %[[CLEANUP_DEST2:.+]] = phi i32 [ %[[CLEANUP_DEST0]], %{{.+}} ], [ %[[CLEANUP_DEST1]], %{{.+}} ], [ 0, %{{.+}} ]
36 // CHECK: call ptr @llvm.coro.free(
37 // CHECK: switch i32 %[[CLEANUP_DEST2]], label %{{.+}} [
38 // CHECK-NEXT: i32 0
39 // CHECK-NEXT: i32 2
40 // CHECK-NEXT: ]