blob: 1b52d559e0113f95dab1e178f057f6d9a2b42b4d [file] [log] [blame]
Xinliang David Li6962659a2016-02-07 07:13:18 +00001// 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
Xinliang David Li4e1aa2d2016-02-07 06:57:29 +00002
Xinliang David Li6962659a2016-02-07 07:13:18 +00003// 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
Xinliang David Li4e1aa2d2016-02-07 06:57:29 +00004
5struct Base {
6 int B;
7 Base() : B(2) {}
Xinliang David Li64581392016-02-08 19:14:14 +00008 Base(const struct Base &b2) {}
Xinliang David Li4e1aa2d2016-02-07 06:57:29 +00009};
10
11struct 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.
Xinliang David Li64581392016-02-08 19:14:14 +000026 // COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }, [5 x
Xinliang David Li4e1aa2d2016-02-07 06:57:29 +000027 // <{{.*}}>],
Xinliang David Li4e1aa2d2016-02-07 06:57:29 +000028};
29
30Derived dd;
31int g;
32int main() {
33 Derived dd2(dd);
Xinliang David Li64581392016-02-08 19:14:14 +000034 g = dd2.B;
Xinliang David Li4e1aa2d2016-02-07 06:57:29 +000035 return 0;
36}