summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-02-08 20:46:26 +0000
committerXinliang David Li <davidxl@google.com>2016-02-08 20:46:26 +0000
commita3be895b6167f2694c1d4cd179cc90ba682230d9 (patch)
tree2d3ca5f2ac9cef24dab551c7f8e51b8d5218cd77
parentf5b462d1e714296d6f8b62aecea408596aa1b7cf (diff)
downloadbcm5719-llvm-a3be895b6167f2694c1d4cd179cc90ba682230d9.tar.gz
bcm5719-llvm-a3be895b6167f2694c1d4cd179cc90ba682230d9.zip
[PGO] Simpflify test and increase coverage
llvm-svn: 260142
-rw-r--r--compiler-rt/test/profile/Linux/coverage_ctors.cpp22
-rw-r--r--compiler-rt/test/profile/Linux/coverage_dtor.cpp17
2 files changed, 20 insertions, 19 deletions
diff --git a/compiler-rt/test/profile/Linux/coverage_ctors.cpp b/compiler-rt/test/profile/Linux/coverage_ctors.cpp
index cb8b1207870..fe4a2be4fcb 100644
--- a/compiler-rt/test/profile/Linux/coverage_ctors.cpp
+++ b/compiler-rt/test/profile/Linux/coverage_ctors.cpp
@@ -5,28 +5,28 @@
struct Base {
int B;
- Base() : B(2) {}
- Base(const struct Base &b2) {
- if (b2.B == 0) {
- B = b2.B + 1;
- } else
- B = b2.B;
+ Base() : B(0) {}
+ Base(const Base &b2) {
+ B = b2.B + 5;
+ }
+ Base(Base &&b2) {
+ B = b2.B + 10;
}
};
struct Derived : public Base {
Derived(const Derived &) = default; // CHECK: 2| [[@LINE]]| Derived(const Derived &) = default;
+ Derived(Derived &&) = default; // CHECK: 1| [[@LINE]]| Derived(Derived &&) = default;
Derived() = default; // CHECK: 1| [[@LINE]]| Derived() = default
- int I;
- int getI() { return I; }
};
Derived dd;
-int g;
int main() {
Derived dd2(dd);
- Derived dd3(dd);
+ Derived dd3(dd2);
+ Derived dd4(static_cast<Derived &&>(dd3));
- g = dd2.getI() + dd3.getI();
+ if (dd.B != 0 || dd2.B != 5 || dd3.B != 10 || dd4.B != 20)
+ return 1; // CHECK: 0| [[@LINE]]| return 1;
return 0;
}
diff --git a/compiler-rt/test/profile/Linux/coverage_dtor.cpp b/compiler-rt/test/profile/Linux/coverage_dtor.cpp
index 8a4a039bee2..c59c34df4bc 100644
--- a/compiler-rt/test/profile/Linux/coverage_dtor.cpp
+++ b/compiler-rt/test/profile/Linux/coverage_dtor.cpp
@@ -3,23 +3,24 @@
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-cov show %t -instr-profile %t.profdata -filename-equivalence 2>&1 | FileCheck %s
+int g = 100;
struct Base {
int B;
Base(int B_) : B(B_) {}
- ~Base() {}
+ ~Base() { g -= B; }
};
struct Derived : public Base {
- Derived(int K) : Base(K), I(K) {}
+ Derived(int K) : Base(K) {}
~Derived() = default; // CHECK: 2| [[@LINE]]| ~Derived() = default;
- int I;
- int getI() { return I; }
};
-int g;
int main() {
- Derived dd(10);
- Derived dd2(120);
- g = dd2.getI() + dd.getI();
+ {
+ Derived dd(10);
+ Derived dd2(90);
+ }
+ if (g != 0)
+ return 1; // CHECK: 0| [[@LINE]]| return 1;
return 0;
}
OpenPOWER on IntegriCloud