summaryrefslogtreecommitdiffstats
path: root/clang/test/CoverageMapping/deferred-region.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Coverage] Discard the last uncompleted deferred region in a declVedant Kumar2018-05-301-6/+18
| | | | | | | | | | | | | | | | | | | Discard the last uncompleted deferred region in a decl, if one exists. This prevents lines at the end of a function containing only whitespace or closing braces from being marked as uncovered, if they follow a region terminator (return/break/etc). The previous behavior was to heuristically complete deferred regions at the end of a decl. In practice this ended up being too brittle for too little gain. Users would complain that there was no way to reach full code coverage because whitespace at the end of a function would be marked uncovered. rdar://40238228 Differential Revision: https://reviews.llvm.org/D46918 llvm-svn: 333609
* [Coverage] Emit deferred regions in headersVedant Kumar2017-11-091-1/+12
| | | | | | | | | | | There are some limitations with emitting regions in macro expansions because we don't gather file IDs within the expansions. Fix the check that prevents us from emitting deferred regions in expansions to make an exception for headers, which is something we can handle. rdar://35373009 llvm-svn: 317760
* [Coverage] Discard deferred region in closing if-elseVedant Kumar2017-10-171-1/+21
| | | | | | | | | | | | | | | | A trailing deferred region isn't necessary in a function that ends with this pattern: ... else { ... return; } Special-case this pattern so that the closing curly brace of the function isn't marked as uncovered. This issue came up in PR34962. llvm-svn: 315982
* [Coverage] Remove deferred region for trailing return, fixes PR34611Vedant Kumar2017-09-191-0/+8
| | | | | | | | As a special case, throw away deferred regions for trailing returns. This allows the closing curly brace to have a count, and is less distracting. llvm-svn: 313603
* [Coverage] Use a new API to label gap areasVedant Kumar2017-09-181-18/+18
| | | | | | | This will make it possible for llvm-cov to pick better line execution counts, and is part of the fix for llvm.org/PR34612. llvm-svn: 313598
* [Coverage] Precise region termination with deferred regions (reapply)Vedant Kumar2017-09-081-0/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert "[Coverage] Precise region termination with deferred regions"Vedant Kumar2017-08-051-142/+0
| | | | | | | | | | | | | | This reverts commit r310010. I don't think there's anything wrong with this commit, but it's causing clang to generate output that llvm-cov doesn't do a good job with and the fix isn't immediately clear. See Eli's comment in D36250 for more context. I'm reverting the clang change so the coverage bot can revert back to producing sensible output, and to give myself some time to investigate what went wrong in llvm. llvm-svn: 310154
* [Coverage] Precise region termination with deferred regionsVedant Kumar2017-08-041-0/+142
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 llvm-svn: 310010
OpenPOWER on IntegriCloud