1 // Ensure that implicit methods aren't instrumented.
2 
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
4 
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_
16 //
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_
21 
22 struct BaseBase {
23  BaseBase();
24  BaseBase(const BaseBase &);
25  BaseBase &operator=(const BaseBase &);
26  BaseBase &operator=(BaseBase &&);
27 };
28 
29 struct Base : public BaseBase {
30   virtual void foo();
31 };
32 
33 struct Derived : public Base {
34   Derived();
35   Derived(const Derived &);
36   Derived(Derived &&);
37   Derived &operator=(const Derived &);
38   Derived &operator=(Derived &&);
39 };
40 
Derived()41 Derived::Derived() {}
Derived(const Derived & d)42 Derived::Derived(const Derived &d) : Base(d) {}
Derived(Derived && d)43 Derived::Derived(Derived &&d) : Base(static_cast<Base&&>(d)) {}
operator =(const Derived & d)44 Derived& Derived::operator=(const Derived &d) {
45   Base::operator=(d);
46   return *this;
47 }
operator =(Derived && d)48 Derived& Derived::operator=(Derived &&d) {
49   Base::operator=(static_cast<Base &&>(d));
50   return *this;
51 }
52