[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CoverageMapping / coroutine.cpp
blob0105005d198a1ccc4025425bce71308a6220d822
1 // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-unknown-linux-gnu -std=c++20 -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping %s -o - | FileCheck %s
3 namespace std {
4 template <typename... T>
5 struct coroutine_traits;
7 template <class Promise = void>
8 struct coroutine_handle {
9 coroutine_handle() = default;
10 static coroutine_handle from_address(void *) noexcept { return {}; }
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 {}
19 } // namespace std
21 struct suspend_always {
22 bool await_ready() noexcept;
23 void await_suspend(std::coroutine_handle<>) noexcept;
24 void await_resume() noexcept;
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 unhandled_exception() noexcept;
34 void return_value(int);
38 // CHECK-LABEL: _Z2f1i:
39 int f1(int x) { // CHECK-NEXT: File 0, [[@LINE]]:15 -> [[@LINE+8]]:2 = #0
40 if (x > 42) { // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = #0
41 // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:7 -> [[@LINE-1]]:13 = #1, (#0 - #1)
42 ++x; // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:14 -> [[@LINE-2]]:15 = #1
43 } else { // CHECK-NEXT: File 0, [[@LINE-3]]:15 -> [[@LINE]]:4 = #1
44 co_return x + 42; // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:4 -> [[@LINE-1]]:10 = (#0 - #1)
45 } // CHECK-NEXT: File 0, [[@LINE-2]]:10 -> [[@LINE]]:4 = (#0 - #1)
46 co_return x; // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:4 -> [[@LINE]]:3 = #1
47 } // CHECK-NEXT: File 0, [[@LINE-1]]:3 -> [[@LINE-1]]:14 = #1