[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / CodeGenCoroutines / coro-await-domination.cpp
blob61082170fc5a6a33b45270b9519caffee0183142
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -emit-llvm %s -o - | FileCheck %s
2 #include "Inputs/coroutine.h"
4 using namespace std;
6 struct coro {
7 struct promise_type {
8 coro get_return_object();
9 suspend_never initial_suspend();
10 suspend_never final_suspend() noexcept;
11 void return_void();
12 static void unhandled_exception();
16 struct A {
17 ~A();
18 bool await_ready();
19 int await_resume() { return 8; }
20 template <typename F> void await_suspend(F);
23 extern "C" void consume(int);
25 // Verifies that domination is properly built during cleanup.
26 // Without CGCleanup.cpp fix verifier was reporting:
27 // Instruction does not dominate all uses!
28 // %tmp.exprcleanup = alloca i32*, align 8
29 // store i32* %x, i32** %tmp.exprcleanup, align 8
32 // CHECK-LABEL: f(
33 extern "C" coro f(int) {
34 int x = 42;
35 x = co_await A{};
36 consume(x);