[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / CodeGenCoroutines / coro-await-domination-exp-namespace.cpp
blob008867eb4bcf1970ec997bb1cc4047097fdaaa98
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -emit-llvm %s -o - | FileCheck %s
2 #include "Inputs/coroutine-exp-namespace.h"
4 using namespace std::experimental;
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
31 // CHECK-LABEL: f(
32 extern "C" coro f(int) {
33 int x = 42;
34 x = co_await A{};
35 consume(x);