| Xinliang David Li | 6962659a | 2016-02-07 07:13:18 +0000 | [diff] [blame] | 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 |
| Xinliang David Li | 4e1aa2d | 2016-02-07 06:57:29 +0000 | [diff] [blame] | 2 | |
| Xinliang David Li | 6962659a | 2016-02-07 07:13:18 +0000 | [diff] [blame] | 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 |
| Xinliang David Li | 4e1aa2d | 2016-02-07 06:57:29 +0000 | [diff] [blame] | 4 | |
| 5 | struct Base { |
| 6 | int B; |
| 7 | Base() : B(2) {} |
| Xinliang David Li | 6458139 | 2016-02-08 19:14:14 +0000 | [diff] [blame] | 8 | Base(const struct Base &b2) {} |
| Xinliang David Li | 4e1aa2d | 2016-02-07 06:57:29 +0000 | [diff] [blame] | 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. |
| Xinliang David Li | 6458139 | 2016-02-08 19:14:14 +0000 | [diff] [blame] | 26 | // COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }, [5 x |
| Xinliang David Li | 4e1aa2d | 2016-02-07 06:57:29 +0000 | [diff] [blame] | 27 | // <{{.*}}>], |
| Xinliang David Li | 4e1aa2d | 2016-02-07 06:57:29 +0000 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | Derived dd; |
| 31 | int g; |
| 32 | int main() { |
| 33 | Derived dd2(dd); |
| Xinliang David Li | 6458139 | 2016-02-08 19:14:14 +0000 | [diff] [blame] | 34 | g = dd2.B; |
| Xinliang David Li | 4e1aa2d | 2016-02-07 06:57:29 +0000 | [diff] [blame] | 35 | return 0; |
| 36 | } |