[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Profile / def-ctors.cpp
blob0179bc92dbb864c87ad49a1dfbeee30617efc623
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
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
5 struct Base {
6 int B;
7 Base() : B(2) {}
8 Base(const struct Base &b2) {}
9 };
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
23 // Check that coverage mapping has 5 function records including
24 // the defaulted Derived::Derived(const Derived), and Derived::Derived()
25 // methds.
26 // COVMAP: section "__llvm_covfun", comdat
27 // COVMAP: section "__llvm_covfun", comdat
28 // COVMAP: section "__llvm_covfun", comdat
29 // COVMAP: section "__llvm_covfun", comdat
30 // COVMAP: section "__llvm_covfun", comdat
31 // COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }
34 Derived dd;
35 int g;
36 int main() {
37 Derived dd2(dd);
38 g = dd2.B;
39 return 0;