1 // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping %s -o - | FileCheck %s 2 3 namespace std { 4 template <typename... T> 5 struct coroutine_traits; 6 7 template <class Promise = void> 8 struct coroutine_handle { 9 coroutine_handle() = default; 10 static coroutine_handle from_address(void *) noexcept { return {}; } 11 }; 12 template <> 13 struct coroutine_handle<void> { 14 static coroutine_handle from_address(void *) { return {}; } 15 coroutine_handle() = default; 16 template <class PromiseType> 17 coroutine_handle(coroutine_handle<PromiseType>) noexcept {} 18 }; 19 } // namespace std 20 21 struct suspend_always { 22 bool await_ready() noexcept; 23 void await_suspend(std::coroutine_handle<>) noexcept; 24 void await_resume() noexcept; 25 }; 26 27 template <> 28 struct std::coroutine_traits<int, int> { 29 struct promise_type { 30 int get_return_object(); 31 suspend_always initial_suspend(); 32 suspend_always final_suspend() noexcept; 33 void return_value(int); 34 }; 35 }; 36 37 // CHECK-LABEL: _Z2f1i: 38 int f1(int x) { // CHECK-NEXT: File 0, [[@LINE]]:15 -> [[@LINE+8]]:2 = #0 39 if (x > 42) { // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = #0 40 // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:13 = #1, (#0 - #1) 41 ++x; // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:14 -> [[@LINE-2]]:15 = #1 42 } else { // CHECK-NEXT: File 0, [[@LINE-3]]:15 -> [[@LINE]]:4 = #1 43 co_return x + 42; // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:4 -> [[@LINE-1]]:10 = (#0 - #1) 44 } // CHECK-NEXT: File 0, [[@LINE-2]]:10 -> [[@LINE]]:4 = (#0 - #1) 45 co_return x; // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:4 -> [[@LINE]]:3 = #1 46 } // CHECK-NEXT: File 0, [[@LINE-1]]:3 -> [[@LINE-1]]:14 = #1 47