2016-02-07 15:13:18 +08:00
|
|
|
// 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
|
2016-02-07 14:57:29 +08:00
|
|
|
|
2016-02-07 15:13:18 +08:00
|
|
|
// 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
|
2016-02-07 14:57:29 +08:00
|
|
|
|
|
|
|
struct Base {
|
|
|
|
int B;
|
|
|
|
Base() : B(2) {}
|
2016-02-09 03:14:14 +08:00
|
|
|
Base(const struct Base &b2) {}
|
2016-02-07 14:57:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Derived : public Base {
|
|
|
|
Derived(const Derived &) = default;
|
|
|
|
// PGOGEN-DAG: define {{.*}}@_ZN7DerivedC2ERKS_
|
|
|
|
// PGOGEN-DAG: %pgocount = load {{.*}} @__profc__ZN7DerivedC2ERKS_
|
|
|
|
// PGOGEN-DAG: {{.*}}add{{.*}}%pgocount, 1
|
|
|
|
// PGOGEN-DAG: store{{.*}}@__profc__ZN7DerivedC2ERKS_
|
|
|
|
Derived() = default;
|
|
|
|
// PGOGEN-DAG: define {{.*}}@_ZN7DerivedC2Ev
|
|
|
|
// PGOGEN-DAG: %pgocount = load {{.*}} @__profc__ZN7DerivedC2Ev
|
|
|
|
// PGOGEN-DAG: {{.*}}add{{.*}}%pgocount, 1
|
|
|
|
// PGOGEN-DAG: store{{.*}}@__profc__ZN7DerivedC2Ev
|
|
|
|
|
2019-10-22 02:48:38 +08:00
|
|
|
// Check that coverage mapping has 5 function records including
|
2016-02-07 14:57:29 +08:00
|
|
|
// the defaulted Derived::Derived(const Derived), and Derived::Derived()
|
|
|
|
// methds.
|
2019-10-22 02:48:38 +08:00
|
|
|
// COVMAP: section "__llvm_covfun", comdat
|
|
|
|
// COVMAP: section "__llvm_covfun", comdat
|
|
|
|
// COVMAP: section "__llvm_covfun", comdat
|
|
|
|
// COVMAP: section "__llvm_covfun", comdat
|
|
|
|
// COVMAP: section "__llvm_covfun", comdat
|
|
|
|
// COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }
|
2016-02-07 14:57:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
Derived dd;
|
|
|
|
int g;
|
|
|
|
int main() {
|
|
|
|
Derived dd2(dd);
|
2016-02-09 03:14:14 +08:00
|
|
|
g = dd2.B;
|
2016-02-07 14:57:29 +08:00
|
|
|
return 0;
|
|
|
|
}
|