blob: 3f6fcff21656df37ce735a665a36597e005114ed [file] [log] [blame]
Xinliang David Li4e1aa2d2016-02-07 06:57:29 +00001// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu
2// -main-file-name def-ctors.cpp -o - -emit-llvm -fprofile-instrument=clang |
3// FileCheck --check-prefix=PGOGEN %s
4
5// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu
6// -main-file-name def-ctors.cpp -o - -emit-llvm -fprofile-instrument=clang
7// -fcoverage-mapping | FileCheck --check-prefix=COVMAP %s
8
9struct Base {
10 int B;
11 Base() : B(2) {}
12 Base(const struct Base &b2) {
13 if (b2.B == 0) {
14 B = b2.B + 1;
15 } else
16 B = b2.B;
17 }
18};
19
20struct Derived : public Base {
21 Derived(const Derived &) = default;
22 // PGOGEN-DAG: define {{.*}}@_ZN7DerivedC2ERKS_
23 // PGOGEN-DAG: %pgocount = load {{.*}} @__profc__ZN7DerivedC2ERKS_
24 // PGOGEN-DAG: {{.*}}add{{.*}}%pgocount, 1
25 // PGOGEN-DAG: store{{.*}}@__profc__ZN7DerivedC2ERKS_
26 Derived() = default;
27 // PGOGEN-DAG: define {{.*}}@_ZN7DerivedC2Ev
28 // PGOGEN-DAG: %pgocount = load {{.*}} @__profc__ZN7DerivedC2Ev
29 // PGOGEN-DAG: {{.*}}add{{.*}}%pgocount, 1
30 // PGOGEN-DAG: store{{.*}}@__profc__ZN7DerivedC2Ev
31
32 // Check that coverage mapping has 6 function records including
33 // the defaulted Derived::Derived(const Derived), and Derived::Derived()
34 // methds.
35 // COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }, [6 x
36 // <{{.*}}>],
37 int I;
38 int J;
39 int getI() { return I; }
40};
41
42Derived dd;
43int g;
44int main() {
45 Derived dd2(dd);
46
47 g = dd2.getI();
48 return 0;
49}