diff options
author | Vedant Kumar <vsk@apple.com> | 2017-09-08 18:44:56 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-09-08 18:44:56 +0000 |
commit | 747b0e2905dc8a2b25d5ae97f5008efcd831795b (patch) | |
tree | 22cb4aabb59e5f990602b1125adfad55033d669a /clang/test/CoverageMapping/trycatch.cpp | |
parent | 79a1b5ee5ab073d4399e025b7ac9e067938293c4 (diff) | |
download | bcm5719-llvm-747b0e2905dc8a2b25d5ae97f5008efcd831795b.tar.gz bcm5719-llvm-747b0e2905dc8a2b25d5ae97f5008efcd831795b.zip |
[Coverage] Precise region termination with deferred regions (reapply)
The current coverage implementation doesn't handle region termination
very precisely. Take for example an `if' statement with a `return':
void f() {
if (true) {
return; // The `if' body's region is terminated here.
}
// This line gets the same coverage as the `if' condition.
}
If the function `f' is called, the line containing the comment will be
marked as having executed once, which is not correct.
The solution here is to create a deferred region after terminating a
region. The deferred region is completed once the start location of the
next statement is known, and is then pushed onto the region stack.
In the cases where it's not possible to complete a deferred region, it
can safely be dropped.
Testing: lit test updates, a stage2 coverage-enabled build of clang
This is a reapplication but there are no changes from the original commit.
With D36813, the segment builder in llvm will be able to handle deferred
regions correctly.
llvm-svn: 312818
Diffstat (limited to 'clang/test/CoverageMapping/trycatch.cpp')
-rw-r--r-- | clang/test/CoverageMapping/trycatch.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/test/CoverageMapping/trycatch.cpp b/clang/test/CoverageMapping/trycatch.cpp index 01d8fb93074..37b35d30987 100644 --- a/clang/test/CoverageMapping/trycatch.cpp +++ b/clang/test/CoverageMapping/trycatch.cpp @@ -18,7 +18,7 @@ void func(int i) { // CHECK-NEXT: File 0, [[@LINE]]:18 -> {{[ // CHECK-NEXT: File 0, [[@LINE+1]]:10 -> [[@LINE+2]]:27 = (#0 - #1) } else if(i == 8) // CHECK-NEXT: File 0, [[@LINE]]:13 -> [[@LINE]]:19 = (#0 - #1) throw ImportantError(); // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:27 = #2 -} +} // CHECK-NEXT: File 0, [[@LINE-1]]:27 -> [[@LINE]]:2 = ((#0 - #1) - #2) // CHECK-NEXT: main int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+13]]:2 = #0 |