diff options
author | Vedant Kumar <vsk@apple.com> | 2017-09-15 23:00:02 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-09-15 23:00:02 +0000 |
commit | 51d8f887db26815576af25c24c5c70b1b03b6830 (patch) | |
tree | c814b7670fc0473b1f57796569e42ff68152a152 /llvm/test/tools/llvm-cov/Inputs/multiple_objects/header.h | |
parent | c445e65d0969dba334b4b1cb545457f98f5c654c (diff) | |
download | bcm5719-llvm-51d8f887db26815576af25c24c5c70b1b03b6830.tar.gz bcm5719-llvm-51d8f887db26815576af25c24c5c70b1b03b6830.zip |
[llvm-cov] Avoid over-counting covered lines and regions
* Fix an unsigned integer overflow in the logic that computes the
number of uncovered lines in a function.
* When aggregating region and line coverage summaries, take into account
that different instantiations may have a different number of regions.
The new test case provides test coverage for both bugs. I also verified
this change by preparing a coverage report for a stage2 build of llc --
the new assertions should detect any outstanding over-counting bugs.
Fixes PR34613.
llvm-svn: 313417
Diffstat (limited to 'llvm/test/tools/llvm-cov/Inputs/multiple_objects/header.h')
-rw-r--r-- | llvm/test/tools/llvm-cov/Inputs/multiple_objects/header.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-cov/Inputs/multiple_objects/header.h b/llvm/test/tools/llvm-cov/Inputs/multiple_objects/header.h new file mode 100644 index 00000000000..03b37cd2dbb --- /dev/null +++ b/llvm/test/tools/llvm-cov/Inputs/multiple_objects/header.h @@ -0,0 +1,29 @@ +static inline void f1() { +#ifdef DEF + if (false && false) + return; + + if (true || false || true) + return; + + if (true && false) + return; +#endif +} + +template<typename T> +void f2(T **x) { +#ifdef DEF + if (false && false) + *x = nullptr; + + if (true || false || true) + *x = nullptr; + + if (true && false) + *x = nullptr; +#endif +} + +static inline void f3() { +} |