1 // RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -main-file-name def-ctors.cpp -o - -emit-llvm -fprofile-instrument=clang | FileCheck --check-prefix=PGOGEN %s
2
3 // RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -main-file-name def-ctors.cpp -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping | FileCheck --check-prefix=COVMAP %s
4
5 struct Base {
6 int B;
BaseBase7 Base() : B(2) {}
BaseBase8 Base(const struct Base &b2) {}
9 };
10
11 struct Derived : public Base {
12 Derived(const Derived &) = default;
13 // PGOGEN-DAG: define {{.*}}@_ZN7DerivedC2ERKS_
14 // PGOGEN-DAG: %pgocount = load {{.*}} @__profc__ZN7DerivedC2ERKS_
15 // PGOGEN-DAG: {{.*}}add{{.*}}%pgocount, 1
16 // PGOGEN-DAG: store{{.*}}@__profc__ZN7DerivedC2ERKS_
17 Derived() = default;
18 // PGOGEN-DAG: define {{.*}}@_ZN7DerivedC2Ev
19 // PGOGEN-DAG: %pgocount = load {{.*}} @__profc__ZN7DerivedC2Ev
20 // PGOGEN-DAG: {{.*}}add{{.*}}%pgocount, 1
21 // PGOGEN-DAG: store{{.*}}@__profc__ZN7DerivedC2Ev
22
23 // Check that coverage mapping has 6 function records including
24 // the defaulted Derived::Derived(const Derived), and Derived::Derived()
25 // methds.
26 // COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }, [5 x
27 // <{{.*}}>],
28 };
29
30 Derived dd;
31 int g;
main()32 int main() {
33 Derived dd2(dd);
34 g = dd2.B;
35 return 0;
36 }
37