[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Profile / cxx-implicit.cpp
blob40598bf0fa2a480e97bb91546923530ac6145b2b
1 // Ensure that implicit methods aren't instrumented.
3 // RUN: %clang_cc1 -x c++ -std=c++11 %s -triple %itanium_abi_triple -main-file-name cxx-implicit.cpp -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s
5 // Implicit constructors are generated for Base. We should not emit counters
6 // for them.
7 // CHECK-DAG: define {{.*}}_ZN4BaseC2Ev
8 // CHECK-DAG: define {{.*}}_ZN4BaseC2ERKS_
9 // CHECK-DAG: define {{.*}}_ZN4BaseC2EOS_
10 // CHECK-DAG: __profc__ZN7DerivedC2Ev,
11 // CHECK-DAG: __profc__ZN7DerivedC2ERKS_
12 // CHECK-DAG: __profc__ZN7DerivedC2EOS_
13 // CHECK-NOT: @__profc__ZN4BaseC2Ev =
14 // CHECK-NOT: @__profc__ZN4BaseC2ERKS_
15 // CHECK-NOT: @__profc__ZN4BaseC2EOS_
17 // Implicit assignment operators are generated for Base. We should not emit counters
18 // for them.
19 // CHECK-NOT: @__profc__ZN4BaseaSEOS_
20 // CHECK-NOT: @__profc__ZN4BaseaSERKS_
22 struct BaseBase {
23 BaseBase();
24 BaseBase(const BaseBase &);
25 BaseBase &operator=(const BaseBase &);
26 BaseBase &operator=(BaseBase &&);
29 struct Base : public BaseBase {
30 virtual void foo();
33 struct Derived : public Base {
34 Derived();
35 Derived(const Derived &);
36 Derived(Derived &&);
37 Derived &operator=(const Derived &);
38 Derived &operator=(Derived &&);
41 Derived::Derived() {}
42 Derived::Derived(const Derived &d) : Base(d) {}
43 Derived::Derived(Derived &&d) : Base(static_cast<Base&&>(d)) {}
44 Derived& Derived::operator=(const Derived &d) {
45 Base::operator=(d);
46 return *this;
48 Derived& Derived::operator=(Derived &&d) {
49 Base::operator=(static_cast<Base &&>(d));
50 return *this;