brintos

brintos / llvm-project-archived public Read only

0
0
Text · 878 B · 6108217 Raw
38 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -emit-llvm %s -o - | FileCheck %s2#include "Inputs/coroutine.h"3 4using namespace std;5 6struct 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();13  };14};15 16struct A {17  ~A();18  bool await_ready();19  int await_resume() { return 8; }20  template <typename F> void await_suspend(F);21};22 23extern "C" void consume(int);24 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 829//  store i32* %x, i32** %tmp.exprcleanup, align 830 31 32// CHECK-LABEL: f(33extern "C" coro f(int) {34  int x = 42;35  x = co_await A{};36  consume(x);37}38