brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · d17654f Raw
35 lines · cpp
1// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -main-file-name def-assignop.cpp -o - -emit-llvm -fprofile-instrument=clang | FileCheck --check-prefix=PGOGEN %s2// RUN: %clang_cc1 -x c++ -std=c++11 %s -triple x86_64-unknown-linux-gnu -main-file-name def-assignop.cpp -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping | FileCheck --check-prefix=COVMAP %s3 4struct B {5  B& operator=(const B &b);6  B& operator=(const B &&b);7};8 9struct A {10  A &operator=(const A &) = default;11  // PGOGEN: define {{.*}}@_ZN1AaSERKS_(12  // PGOGEN: %pgocount = load {{.*}} @__profc__ZN1AaSERKS_13  // PGOGEN: {{.*}}add{{.*}}%pgocount, 114  // PGOGEN: store{{.*}}@__profc__ZN1AaSERKS_15  A &operator=(A &&) = default;16  // PGOGEN: define {{.*}}@_ZN1AaSEOS_17  // PGOGEN: %pgocount = load {{.*}} @__profc__ZN1AaSEOS_18  // PGOGEN: {{.*}}add{{.*}}%pgocount, 119  // PGOGEN: store{{.*}}@__profc__ZN1AaSEOS_20 21  // Check that coverage mapping includes 3 function records including the22  // defaulted copy and move operators: A::operator=23  // COVMAP: section "__llvm_covfun", comdat24  // COVMAP: section "__llvm_covfun", comdat25  // COVMAP: section "__llvm_covfun", comdat26  // COVMAP: @__llvm_coverage_mapping = {{.*}} { { i32, i32, i32, i32 }27  B b;28};29 30A a1, a2;31void foo() {32  a1 = a2;33  a2 = static_cast<A &&>(a1);34}35