summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/test/profile/Linux/coverage_assignop.cpp42
-rw-r--r--compiler-rt/test/profile/Linux/coverage_ctors.cpp5
-rw-r--r--compiler-rt/test/profile/Linux/coverage_dtor.cpp5
3 files changed, 46 insertions, 6 deletions
diff --git a/compiler-rt/test/profile/Linux/coverage_assignop.cpp b/compiler-rt/test/profile/Linux/coverage_assignop.cpp
new file mode 100644
index 00000000000..ea78de78a4a
--- /dev/null
+++ b/compiler-rt/test/profile/Linux/coverage_assignop.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang_profgen -x c++ -std=c++11 -fuse-ld=gold -fcoverage-mapping -o %t %s
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
+// RUN: llvm-profdata merge -o %t.profdata %t.profraw
+// RUN: llvm-cov show %t -instr-profile %t.profdata -filename-equivalence 2>&1 | FileCheck %s
+struct Base1 {
+ int B;
+ Base1(int b) : B(b) {}
+ void operator=(const struct Base1 &b) { B = b.B + 1; }
+};
+
+struct Base2 {
+ int B;
+ Base2(int b) : B(b) {}
+ void operator=(const struct Base2 &b) { B = b.B; }
+};
+
+struct Derived1 : public Base1 {
+ Derived1() : Base1(10) {}
+ Derived1(int B) : Base1(B) {}
+ Derived1 &operator=(const Derived1 &) = default; // CHECK: 2| [[@LINE]]| Derived1 &operator=(const Derived1 &) = default;
+};
+
+struct Derived2 : public Derived1, public Base2 {
+ Derived2() : Derived1(20), Base2(30) {}
+ Derived2(int B1, int B2) : Derived1(B1), Base2(B2) {}
+ Derived2 &operator=(const Derived2 &) = default; // CHECK: 1| [[@LINE]]| Derived2 &operator=(const Derived2 &) = default;
+};
+
+Derived1 d1(1);
+Derived2 d2(2, 3);
+
+int main() {
+ Derived1 ld1;
+ Derived2 ld2;
+ Derived2 ld22;
+ ld1 = d1;
+ ld2 = d2;
+ if (ld1.B != 2 || ld2.Base1::B != 3 || ld2.Base2::B != 3 ||
+ ld22.Base1::B != 20 || ld22.Base2::B != 30)
+ return 1;
+ return 0;
+}
diff --git a/compiler-rt/test/profile/Linux/coverage_ctors.cpp b/compiler-rt/test/profile/Linux/coverage_ctors.cpp
index 336cf147ca1..cb8b1207870 100644
--- a/compiler-rt/test/profile/Linux/coverage_ctors.cpp
+++ b/compiler-rt/test/profile/Linux/coverage_ctors.cpp
@@ -15,10 +15,9 @@ struct Base {
};
struct Derived : public Base {
- Derived(const Derived &) = default; // CHECK: 2| [[@LINE]]| Derived
- Derived() = default; // CHECK: 1| [[@LINE]]| Derived
+ Derived(const Derived &) = default; // CHECK: 2| [[@LINE]]| Derived(const Derived &) = default;
+ Derived() = default; // CHECK: 1| [[@LINE]]| Derived() = default
int I;
- int J;
int getI() { return I; }
};
diff --git a/compiler-rt/test/profile/Linux/coverage_dtor.cpp b/compiler-rt/test/profile/Linux/coverage_dtor.cpp
index b24bfb8a4a4..8a4a039bee2 100644
--- a/compiler-rt/test/profile/Linux/coverage_dtor.cpp
+++ b/compiler-rt/test/profile/Linux/coverage_dtor.cpp
@@ -10,10 +10,9 @@ struct Base {
};
struct Derived : public Base {
- Derived(int K) : Base(K), I(K), J(K) {}
- ~Derived() = default; // CHECK: 2| [[@LINE]]| ~Derived
+ Derived(int K) : Base(K), I(K) {}
+ ~Derived() = default; // CHECK: 2| [[@LINE]]| ~Derived() = default;
int I;
- int J;
int getI() { return I; }
};
OpenPOWER on IntegriCloud