41 lines · cpp
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 %s2 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 %s4 5struct Base {6 int B;7 Base() : B(2) {}8 Base(const struct Base &b2) {}9};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, 116 // PGOGEN-DAG: store{{.*}}@__profc__ZN7DerivedC2ERKS_17 Derived() = default;18 // PGOGEN-DAG: define {{.*}}@_ZN7DerivedC2Ev19 // PGOGEN-DAG: %pgocount = load {{.*}} @__profc__ZN7DerivedC2Ev20 // PGOGEN-DAG: {{.*}}add{{.*}}%pgocount, 121 // PGOGEN-DAG: store{{.*}}@__profc__ZN7DerivedC2Ev22 23 // Check that coverage mapping has 5 function records including24 // the defaulted Derived::Derived(const Derived), and Derived::Derived()25 // methds.26 // COVMAP: section "__llvm_covfun", comdat27 // COVMAP: section "__llvm_covfun", comdat28 // COVMAP: section "__llvm_covfun", comdat29 // COVMAP: section "__llvm_covfun", comdat30 // COVMAP: section "__llvm_covfun", comdat31 // COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }32};33 34Derived dd;35int g;36int main() {37 Derived dd2(dd);38 g = dd2.B;39 return 0;40}41