1// RUN: %clangxx_profgen -std=c++11 -fuse-ld=gold -fcoverage-mapping -o %t %s
2// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
3// RUN: llvm-profdata merge -o %t.profdata %t.profraw
4// RUN: llvm-cov show %t -instr-profile %t.profdata 2>&1 | FileCheck %s
5
6struct Base {
7 int B;
8 Base() : B(0) {}
9 Base(const Base &b2) {
10 B = b2.B + 5;
11 }
12 Base(Base &&b2) {
13 B = b2.B + 10;
14 }
15};
16
17struct Derived : public Base {
18 Derived(const Derived &) = default; // CHECK: [[@LINE]]| 2| Derived(const Derived &) = default;
19 Derived(Derived &&) = default; // CHECK: [[@LINE]]| 1| Derived(Derived &&) = default;
20 Derived() = default; // CHECK: [[@LINE]]| 1| Derived() = default
21};
22
23Derived dd;
24int main() {
25 Derived dd2(dd);
26 Derived dd3(dd2);
27 Derived dd4(static_cast<Derived &&>(dd3));
28
29 if (dd.B != 0 || dd2.B != 5 || dd3.B != 10 || dd4.B != 20)
30 return 1; // CHECK: [[@LINE]]| 0| return 1;
31 return 0;
32}
33

source code of compiler-rt/test/profile/Linux/coverage_ctors.cpp