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 6 function records including the
22 // defaulted copy and move operators: A::operator=
23 // COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }, [3 x <{{.*}}>],
24 B b;
25 };
26
27 A a1, a2;
foo()28 void foo() {
29 a1 = a2;
30 a2 = static_cast<A &&>(a1);
31 }
32