reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
// RUN: %clangxx_profgen -std=c++11 -fuse-ld=gold -fcoverage-mapping -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-cov show %t -instr-profile %t.profdata -path-equivalence=/tmp,%S 2>&1 | FileCheck %s

struct Base {
  int B;
  Base() : B(0) {}
  Base(const Base &b2) {
    B = b2.B + 5;
  }
  Base(Base &&b2) {
    B = b2.B + 10;
  }
};

struct Derived : public Base {
  Derived(const Derived &) = default; // CHECK:  [[@LINE]]| 2|  Derived(const Derived &) = default;
  Derived(Derived &&) = default;      // CHECK:  [[@LINE]]| 1| Derived(Derived &&) = default;
  Derived() = default;                // CHECK:  [[@LINE]]| 1| Derived() = default
};

Derived dd;
int main() {
  Derived dd2(dd);
  Derived dd3(dd2);
  Derived dd4(static_cast<Derived &&>(dd3));

  if (dd.B != 0 || dd2.B != 5 || dd3.B != 10 || dd4.B != 20)
    return 1;                         // CHECK: [[@LINE]]| 0|     return 1;
  return 0;
}