blob: 2d453364a55d47ebc8e31f6fbd9d50e304ac8b29 [file] [log] [blame]
Xinliang David Lia951e8e2016-02-09 20:02:59 +00001// 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
4struct B {
5 B& operator=(const B &b);
6 B& operator=(const B &&b);
7};
8
9struct 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
Xinliang David Li13cf09d2016-02-17 00:59:01 +000027A a1, a2;
28void foo() {
Xinliang David Lia951e8e2016-02-09 20:02:59 +000029 a1 = a2;
30 a2 = static_cast<A &&>(a1);
Xinliang David Lia951e8e2016-02-09 20:02:59 +000031}