diff options
author | Stephen Hines <srhines@google.com> | 2014-02-11 20:01:10 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-02-11 20:01:10 -0800 |
commit | ce9904c6ea8fd669978a8eefb854b330eb9828ff (patch) | |
tree | 2418ee2e96ea220977c8fb74959192036ab5b133 /test/tools/llvm-cov/Inputs/test.cpp | |
parent | c27b10b198c1d9e9b51f2303994313ec2778edd7 (diff) | |
parent | dbb832b83351cec97b025b61c26536ef50c3181c (diff) | |
download | external_llvm-ce9904c6ea8fd669978a8eefb854b330eb9828ff.zip external_llvm-ce9904c6ea8fd669978a8eefb854b330eb9828ff.tar.gz external_llvm-ce9904c6ea8fd669978a8eefb854b330eb9828ff.tar.bz2 |
Merge remote-tracking branch 'upstream/release_34' into merge-20140211
Conflicts:
lib/Linker/LinkModules.cpp
lib/Support/Unix/Signals.inc
Change-Id: Ia54f291fa5dc828052d2412736e8495c1282aa64
Diffstat (limited to 'test/tools/llvm-cov/Inputs/test.cpp')
-rw-r--r-- | test/tools/llvm-cov/Inputs/test.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/test/tools/llvm-cov/Inputs/test.cpp b/test/tools/llvm-cov/Inputs/test.cpp new file mode 100644 index 0000000..07bc3f2 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test.cpp @@ -0,0 +1,77 @@ +#include <cstdlib> + +bool on = false; +int len = 42; +double grid[10][10] = {0}; +const char * hello = "world"; +const char * world = "hello"; + +struct A { + virtual void B(); +}; + +void A::B() {} + +void useless() {} + +double more_useless() { + return 0; +} + +int foo() { + on = true; + return 3; +} + +int bar() { + len--; + return foo() + 45; +} + +void assign(int ii, int jj) { + grid[ii][jj] = (ii+1) * (jj+1); +} + +void initialize_grid() { + for (int ii = 0; ii < 2; ii++) + for (int jj = 0; jj < 2; jj++) + assign(ii, jj); +} + +int main() { + initialize_grid(); + + int a = 2; + on = rand() % 2; + if (on) { + foo(); + ++a; + } else { + bar(); + a += rand(); + } + + for (int ii = 0; ii < 10; ++ii) { + switch (rand() % 5) { + case 0: + a += rand(); + break; + case 1: + case 2: + a += rand() / rand(); + break; + case 3: + a -= rand(); + break; + default: + a = -1; + } + } + + A thing; + for (uint64_t ii = 0; ii < 4294967296; ++ii) + thing.B(); + + return a + 8 + grid[2][3] + len; + return more_useless(); +} |