| 1 |
// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -main-file-name def-assignop.cpp -o - -emit-llvm -fprofile-instrument=clang | FileCheck --check-prefix=PGOGEN %s |
| 2 |
// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -main-file-name def-assignop.cpp -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping | FileCheck --check-prefix=COVMAP %s |
| 3 |
|
| 4 |
struct B { |
| 5 |
B& operator=(const B &b); |
| 6 |
B& operator=(const B &&b); |
| 7 |
}; |
| 8 |
|
| 9 |
struct A { |
| 10 |
A &operator=(const A &) = default; |
| 11 |
// PGOGEN: define {{.*}}@_ZN1AaSERKS_( |
| 12 |
// PGOGEN: %pgocount = load {{.*}} @__profc__ZN1AaSERKS_ |
| 13 |
// PGOGEN: {{.*}}add{{.*}}%pgocount, 1 |
| 14 |
// PGOGEN: store{{.*}}@__profc__ZN1AaSERKS_ |
| 15 |
A &operator=(A &&) = default; |
| 16 |
// PGOGEN: define {{.*}}@_ZN1AaSEOS_ |
| 17 |
// PGOGEN: %pgocount = load {{.*}} @__profc__ZN1AaSEOS_ |
| 18 |
// PGOGEN: {{.*}}add{{.*}}%pgocount, 1 |
| 19 |
// PGOGEN: store{{.*}}@__profc__ZN1AaSEOS_ |
| 20 |
|
| 21 |
// Check that coverage mapping includes 3 function records including the |
| 22 |
// defaulted copy and move operators: A::operator= |
| 23 |
// COVMAP: section "__llvm_covfun", comdat |
| 24 |
// COVMAP: section "__llvm_covfun", comdat |
| 25 |
// COVMAP: section "__llvm_covfun", comdat |
| 26 |
// COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 } |
| 27 |
B b; |
| 28 |
}; |
| 29 |
|
| 30 |
A a1, a2; |
| 31 |
void foo() { |
| 32 |
a1 = a2; |
| 33 |
a2 = static_cast<A &&>(a1); |
| 34 |
} |