• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 -filename-equivalence 2>&1 | FileCheck %s
5 
6 struct Base {
7   int B;
BaseBase8   Base() : B(0) {}
BaseBase9   Base(const Base &b2) {
10     B = b2.B + 5;
11   }
BaseBase12   Base(Base &&b2) {
13     B = b2.B + 10;
14   }
15 };
16 
17 struct Derived : public Base {
18   Derived(const Derived &) = default; // CHECK:  2| [[@LINE]]|  Derived(const Derived &) = default;
19   Derived(Derived &&) = default;      // CHECK:  1| [[@LINE]]|  Derived(Derived &&) = default;
20   Derived() = default;                // CHECK:  1| [[@LINE]]|  Derived() = default
21 };
22 
23 Derived dd;
main()24 int 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: 0| [[@LINE]]|     return 1;
31   return 0;
32 }
33