summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/SourceCoverageView.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-cov] Don't render empty region marker linesVedant Kumar2017-11-091-8/+11
| | | | | | | This fixes an issue where llvm-cov prints an empty line, thinking it needs to display region markers, when it actually doesn't. llvm-svn: 317762
* [llvm-cov] Use a stable sort on sub-viewsVedant Kumar2017-10-241-2/+2
| | | | | | | | | | | We need to use a stable sort on instantiation and expansion sub-views to produce consistent output. Fortunately, we've gotten lucky and the tests have checks for the stable order. This is needed to unblock D39245. Once that lands, we'll have better test coverage for sort non-determinism. llvm-svn: 316490
* [llvm-cov] Use the coverage namespace. NFC.Vedant Kumar2017-10-181-6/+5
| | | | | | | This is a simple code cleanup. It will facilitate moving LineCoverageIterator to libCoverage. llvm-svn: 316140
* [llvm-cov] Pass LineCoverageStats in SourceCoverageView. NFC.Vedant Kumar2017-10-181-6/+4
| | | | | | | | | Instead of copying around the wrapped segment and the list of line segments, just pass a reference to a LineCoverageStats object. This simplifies the interface. It also makes an upcoming change to suppress distracting highlights possible. llvm-svn: 316108
* [llvm-cov] Factor out logic to iterate over line coverage stats (NFC)Vedant Kumar2017-10-141-21/+15
| | | | | | | | | | There were two copies of the logic needed to construct a line stats object for each line in a range: this patch brings it down to one. In the future, this will make it easier for IDE clients to display coverage in-line in source editors. To do that, we just need to move the new LineCoverageIterator class to libCoverage. llvm-svn: 315789
* [llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson2017-09-281-2/+3
| | | | | | | | | | | Before this change using any of the -name*= command line options with an output directory would result in a single file (functions.txt/functions.html) containing the coverage for those specific functions. Now you get the same directory structure as when not using any -name*= options. Differential Revision: https://reviews.llvm.org/D38280 llvm-svn: 314396
* Revert "[llvm-cov] Create directory structure when filtering using -name*= ↵Sean Eveson2017-09-271-3/+2
| | | | | | | | options" Test failures. llvm-svn: 314314
* [llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson2017-09-271-2/+3
| | | | | | | | | | | Before this change using any of the -name*= command line options with an output directory would result in a single file (functions.txt/functions.html) containing the coverage for those specific functions. Now you get the same directory structure as when not using any -name*= options. Differential Revision: https://reviews.llvm.org/D38280 llvm-svn: 314310
* [llvm-cov] Make report metrics agree with line exec counts, fixes PR34615Vedant Kumar2017-09-191-44/+0
| | | | | | | | | Use the same logic as the line-oriented coverage view to determine the number of covered lines in a function. Fixes llvm.org/PR34615. llvm-svn: 313604
* [Coverage] Use gap regions to select better line exec countsVedant Kumar2017-09-181-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | After clang started emitting deferred regions (r312818), llvm-cov has had a hard time picking reasonable line execuction counts. There have been one or two generic improvements in this area (e.g r310012), but line counts can still report coverage for whitespace instead of code (llvm.org/PR34612). To fix the problem: * Introduce a new region kind so that frontends can explicitly label gap areas. This is done by changing the encoding of the columnEnd field of MappingRegion. This doesn't substantially increase binary size, and makes it easy to maintain backwards-compatibility. * Don't set the line count to a count from a gap area, unless the count comes from a wrapped segment. * Don't highlight gap areas as uncovered. Fixes llvm.org/PR34612. llvm-svn: 313597
* [llvm-cov] Simplify code to find the first uncovered segment. NFC.Vedant Kumar2017-09-181-14/+8
| | | | | | | Now that that segment builder is guaranteed to produce segments in sorted order, we don't need a linear scan to get the right result. llvm-svn: 313595
* [llvm-cov] Don't attach exec counts to lines which start a skipped regionVedant Kumar2017-09-111-1/+7
| | | | | | | | | These lines by definition don't have an execution count. This is the final part of the fix for: https://bugs.llvm.org/show_bug.cgi?id=34166 llvm-svn: 312955
* [llvm-cov] Unify region marker placement between text/html modesVedant Kumar2017-09-081-4/+12
| | | | | | | | | | | | Make sure that the text and html emitters always emit the same set of region markers, and avoid emitting redundant markers for line segments which don't end on the line they start on. This is related to D35925, and depends on D36014 Differential Revision: https://reviews.llvm.org/D36020 llvm-svn: 312813
* [llvm-cov] Ignore unclosed line segments when setting line countsVedant Kumar2017-08-041-8/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes a slight change to the way llvm-cov determines line execution counts. If there are multiple line segments on a line, the line count is the max count among the regions which start *and* end on the line. This avoids an issue posed by deferred regions which start on the same line as a terminated region, e.g: if (false) return; //< The line count should be 0, even though a new region //< starts at the semi-colon. foo(); Another change is that counts from line segments which don't correspond to region entries are considered. This enables the first change, and corrects an outstanding issue (see the showLineExecutionCounts.cpp test change). This is related to D35925. Testing: check-profile, llvm-cov lit tests Differential Revision: https://reviews.llvm.org/D36014 llvm-svn: 310012
* [llvm-cov] Do not print out the filename of the object fileVedant Kumar2016-10-251-5/+0
| | | | | | | | | When we load coverage data from multiple objects, we don't have a way to attribute a source object to a function record. Printing out the object filename next to the source filename is already not very useful: soon, it'll actually become misleading. Stop printing out the filename now. llvm-svn: 285043
* [llvm-cov] Move some layout logic to the right spot (NFC)Vedant Kumar2016-09-151-1/+2
| | | | llvm-svn: 281590
* [llvm-cov] Make a method name more accurate (NFC)Vedant Kumar2016-09-151-1/+1
| | | | llvm-svn: 281581
* [llvm-cov] Don't print a verbose title when looking at one fileVedant Kumar2016-09-151-1/+1
| | | | | | | Having the same title, timestamp, etc. occur repeatedly creates an unnecessary distraction when paging through a report. llvm-svn: 281579
* [llvm-cov] Move the 'jump to first unexecuted line' linkVedant Kumar2016-09-101-6/+3
| | | | | | | Having it in the same row as the source name is jarring. Move it next to the "Source" column label. llvm-svn: 281146
* [llvm-cov] Minor visual tweaks for html reportsVedant Kumar2016-09-101-2/+2
| | | | | | | - Change the location of the 'Region Coverage' column. - Use less css and text for some labels. llvm-svn: 281145
* [llvm-cov] Constify some methods (NFC)Vedant Kumar2016-09-091-2/+3
| | | | llvm-svn: 281010
* [llvm-cov] Use less space to describe source namesVedant Kumar2016-09-081-9/+11
| | | | | | | | In r279628, we made SourceCoverageView list the binary associated with a view and started adding labels (e.g "Source: foo" or "Function: bar") to everything. Condense this information a bit to unclutter reports. llvm-svn: 280896
* [llvm-cov] Add the project summary to the text coverage report for each ↵Ying Yi2016-09-061-0/+9
| | | | | | | | | | source file. This patch is a spin-off from https://reviews.llvm.org/D23922. It extends the text view to preserve the same feature as the html view. Differential Revision: https://reviews.llvm.org/D24241 llvm-svn: 280756
* [llvm-cov] Add the "Go to first unexecuted line" feature.Ying Yi2016-09-061-1/+24
| | | | | | | | This patch provides easy navigation to find the zero count lines, especially useful when the source file is very large. Differential Revision: https://reviews.llvm.org/D23277 llvm-svn: 280739
* [llvm-cov] Use the native path in the coverage report.Ying Yi2016-08-301-0/+1
| | | | | | | | | | | The coverage reports contain the source or binary file paths. On Windows, the file path might contain the seperators of both '/' and '\'. This patch uses the native path in the coverage reports. For example, on Windows, all '/' are converted to '\'. Differential Revision: https://reviews.llvm.org/D23922 llvm-svn: 280061
* [llvm-cov] Add the project summary to each source file coverage report.Ying Yi2016-08-241-7/+12
| | | | | | | | | | | | This patch includes the following changes: - Included header "Code coverage report" and include the date that the report was created. - Included title (as specified in a command line option, (i.e llvm-cov -project-title="Simple Test") - In the summary, list the elf files that the source code file has contributed to. - Used column heading for "Line No.", "Count No.", Source". Differential Revision: https://reviews.llvm.org/D23345 llvm-svn: 279628
* [llvm-cov] Swapped the line and count columns.Ying Yi2016-08-091-2/+2
| | | | | | | | | In the coverage report, the line and count columns have been swapped to make it more readable. A follow-up commit in compiler-rt is needed Differential Revision: https://reviews.llvm.org/D23281 llvm-svn: 278152
* [llvm-cov] Add support for creating html reportsVedant Kumar2016-07-061-0/+6
| | | | | | | | Based on a patch by Harlan Haskins! Differential Revision: http://reviews.llvm.org/D18278 llvm-svn: 274688
* [llvm-cov] Use relative paths to file reports in -output-dir modeVedant Kumar2016-06-291-3/+7
| | | | | | This makes it possible to e.g copy a report to another filesystem. llvm-svn: 274173
* [llvm-cov] Do not allow ".." to escape the coverage sub-directoryVedant Kumar2016-06-291-2/+3
| | | | | | | | | | | In -output-dir mode, file reports are placed into a "coverage" directory. If filenames in the coverage mapping contain "..", they might escape out of this directory. Fix the problem by removing ".." from source filenames (expand the path component). llvm-svn: 274135
* [llvm-cov] Minor cleanups to prepare for the html format patchVedant Kumar2016-06-291-8/+18
| | | | | | | | | | | | - Add renderView{Header,Footer}, renderLineSuffix, and hasSubViews to support creating tables with nested views. - Move the 'Format' cl::opt to make it easier to extend. - Just create one function view file, instead of overwriting the same file for every new function. Add a regression test for this. llvm-svn: 274086
* Fix "not all control paths return a value" warning on MSVCSimon Pilgrim2016-06-281-0/+1
| | | | llvm-svn: 274065
* [llvm-cov] Create an index of reports in -output-dir modeVedant Kumar2016-06-281-47/+53
| | | | | | | | | | This index lists the reports available in the 'coverage' sub-directory. This will help navigate coverage output from large projects. This commit factors the file creation code out of SourceCoverageView and into CoveragePrinter. llvm-svn: 274029
* [llvm-cov] Rename ShowFormat to Format (NFC)Vedant Kumar2016-06-281-1/+1
| | | | | | | This makes it a bit more generic, in case we want to emit summary reports in different formats in the future. llvm-svn: 274026
* [llvm-cov] Move a check into a helper method (NFC)Vedant Kumar2016-06-281-1/+1
| | | | llvm-svn: 274025
* Fix "not all control paths return a value" warning on MSVCSimon Pilgrim2016-06-281-0/+1
| | | | llvm-svn: 274011
* Reapply "[llvm-cov] Add an -output-dir option for the show sub-command""Vedant Kumar2016-06-281-0/+47
| | | | | | | | | | | | | | | Passing -output-dir path/to/dir to llvm-cov show creates path/to/dir if it doesn't already exist, and prints reports into that directory. In function view mode, all views are written into path/to/dir/functions.$EXTENSION. In file view mode, all views are written into path/to/dir/coverage/$PATH.$EXTENSION. Changes since the initial commit: - Avoid accidentally closing stdout twice. llvm-svn: 273985
* Revert "[llvm-cov] Add an -output-dir option for the show sub-command"Vedant Kumar2016-06-281-45/+0
| | | | | | | This reverts commit r273971. test/profile/instrprof-visibility.cpp is failing because of an uncaught error in SafelyCloseFileDescriptor. llvm-svn: 273978
* [llvm-cov] Add an -output-dir option for the show sub-commandVedant Kumar2016-06-281-0/+45
| | | | | | | | | | | Passing -output-dir path/to/dir to llvm-cov show creates path/to/dir if it doesn't already exist, and prints reports into that directory. In function view mode, all views are written into path/to/dir/functions.$EXTENSION. In file view mode, all views are written into path/to/dir/coverage/$PATH.$EXTENSION. llvm-svn: 273971
* [llvm-cov] Add a format option for the 'show' sub-command (mostly NFC)Vedant Kumar2016-06-281-2/+5
| | | | llvm-svn: 273968
* [llvm-cov] Simplify the way expansion views are rendered (NFC)Vedant Kumar2016-06-261-5/+13
| | | | | | | | | If a sub-view has already been rendered, it's helpful to re-render the expansion site before rendering the next expansion view. Make this fact explicit in the rendering interface, instead of hiding it behind an awkward Optional<LineRef> parameter. llvm-svn: 273789
* [llvm-cov] Make an API more consistent, NFCVedant Kumar2016-06-251-1/+1
| | | | | | | Make renderExpansionView() look a bit more like renderLine(), and clarify its doxygen comment. llvm-svn: 273773
* [llvm-cov] Flesh out some doxygen comments, NFCVedant Kumar2016-06-251-3/+3
| | | | llvm-svn: 273772
* [llvm-cov] Separate presentation logic from formatting logic, NFCVedant Kumar2016-06-251-157/+34
| | | | | | | | | | This makes it easier to add renderers for new kinds of output formats. - Define and document a pure-virtual coverage rendering interface. - Move the text-based rendering logic into its a new file. - Re-work the API to better reflect the presentation/formatting split. llvm-svn: 273767
* [llvm-cov] Use getOptions() instead of Options in SourceCoverageView, NFCVedant Kumar2016-06-241-14/+16
| | | | | | | A lot of this code is going to move into the text-based coverage renderer, and won't be able to use Options directly. Use the getter. llvm-svn: 273635
* [llvm-cov] Add SourceNames to SourceCoverageViews, NFCVedant Kumar2016-06-241-3/+6
| | | | | | | | | | | | | A SourceName can be a file or a function. It makes sense to attach this information to a SourceCoverageView, seeing as views (1) already point to the text corresponding to the relevant source code and (2) are already used to render that text along with the SourceNames. This is a nice cleanup which is independent of the upcoming html patch. While we're at it, document the fields in SourceCoverageView. llvm-svn: 273634
* [llvm-cov] Rename SourceCoverageView::LineCoverageInfo to LineCoverageStats, NFCVedant Kumar2016-06-241-2/+2
| | | | | | | | | | | | Pull LineCoverageInfo out of SourceCoverageView and rename it so that it doesn't conflict with another class of the same name in CoverageSummaryInfo.h. This cuts down on the amount of code we have to move into a `protected` section of SourceCoverageView for the upcoming html patch. It also makes the code a bit clearer: having two LineCoverageInfo's is strange. llvm-svn: 273633
* InstrProf: Fix display of large numbers in llvm-covJustin Bogner2015-05-131-21/+25
| | | | | | | | llvm-cov was truncating numbers that were larger than a particular fixed width, which is as confusing as it is useless. Instead, we use engineering notation with SI prefix for magnitude. llvm-svn: 237307
* llvm-cov: Disentangle the coverage data logic from the display (NFC)Justin Bogner2014-09-201-12/+10
| | | | | | | | | | This splits the logic for actually looking up coverage information from the logic that displays it. These were tangled rather thoroughly so this change is a bit large, but it mostly consists of moving things around. The coverage lookup logic itself now lives in the library, rather than being spread between the library and the tool. llvm-svn: 218184
* llvm-cov: Fix dropped lines when filters were appliedJustin Bogner2014-09-191-1/+2
| | | | | | | Uncovered lines in the middle of a covered region weren't being shown when filtering to a particular function. llvm-svn: 218109
OpenPOWER on IntegriCloud