summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ADT] Make escaping fn conform to coding guidelinesJonas Devlieghere2018-05-311-1/+1
| | | | | | | | As noted by Adrian on llvm-commits, PrintHTMLEscaped and PrintEscaped in StringExtras did not conform to the LLVM coding guidelines. This commit rectifies that. llvm-svn: 333669
* [llvm-cov] Use the new PrintHTMLEscaped utilityVedant Kumar2018-05-301-20/+18
| | | | | | This removes some duplicate logic to escape characters in HTML output. llvm-svn: 333608
* [Coverage] Update CSS to make HTML reports copy-paste friendly.Max Moroz2018-05-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | Summary: This minor change allows to copy snippets from HTML reports so they will be pasted in the following format: %LineNumber%\t%HitCount%\t%CodeLine% rather then being split onto multiple lines. To see this in action, try copy pasting from https://chromium-coverage.appspot.com/reports/560344/linux/chromium/src/third_party/zlib/compress.c.html Requested in https://bugs.chromium.org/p/chromium/issues/detail?id=845571 Reviewers: vsk Reviewed By: vsk Subscribers: llvm-commits, morehouse, kcc Differential Revision: https://reviews.llvm.org/D47231 llvm-svn: 333034
* [llvm-cov] Fix incorrect usage of .precision specifier in format() call.Max Moroz2018-01-311-1/+1
| | | | | | | | | | | | | | Summary: Existing version doesn't work on Windows as it always prints 0.00. Reviewers: Dor1s Reviewed By: Dor1s Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42767 llvm-svn: 323923
* [llvm-cov] Improvements for summary report generated in HTML format.Max Moroz2018-01-311-14/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit adds the following changes: 1) coverage numbers are aligned to the left and padded with spaces in order to provide better readability for percentage values, e.g.: ``` file1 | 89.13% (123 / 2323) | 100.00% (55 / 55) | 9.33% (14545 / 234234) file_asda | 1.78% ( 23 / 4323) | 32.31% (555 / 6555) | 67.89% (1545 / 2234) fileXXX | 100.00% (12323 / 12323) | 100.00% (555 / 555) | 100.00% (12345 / 12345) ``` 2) added "hover" attribute to CSS for highlighting table row under mouse cursor see screenshot attached to the phabricator review page {F5764813} 3) table title row and "totals" row now use bold text Reviewers: vsk, morehouse Reviewed By: vsk Subscribers: kcc, llvm-commits Differential Revision: https://reviews.llvm.org/D42093 llvm-svn: 323892
* Remove redundant includes from tools.Michael Zolotukhin2017-12-131-1/+0
| | | | llvm-svn: 320631
* [llvm-cov] Don't render empty region marker linesVedant Kumar2017-11-091-1/+1
| | | | | | | 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
* [Coverage] Use the wrapped segment when a line has entry segmentsVedant Kumar2017-11-091-6/+6
| | | | | | | | | We've worked around bugs in the frontend by ignoring the count from wrapped segments when a line has at least one region entry segment. Those frontend bugs are now fixed, so it's time to regenerate the checked-in covmapping files and remove the workaround. llvm-svn: 317761
* [llvm-cov] Use the coverage namespace. NFC.Vedant Kumar2017-10-181-3/+2
| | | | | | | This is a simple code cleanup. It will facilitate moving LineCoverageIterator to libCoverage. llvm-svn: 316140
* [llvm-cov] Suppress sub-line highlights in simple casesVedant Kumar2017-10-181-0/+2
| | | | | | | | | | llvm-cov tends to highlight too many regions because its policy is to highlight all region entry segments. This can look confusing to users: not all region entry segments are interesting and deserve highlighting. Emitting these highlights only when the region count differs from the line count is a more user-friendly policy. llvm-svn: 316109
* [llvm-cov] Pass LineCoverageStats in SourceCoverageView. NFC.Vedant Kumar2017-10-181-9/+11
| | | | | | | | | 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] Highlight gaps in consecutive uncovered regionsVedant Kumar2017-10-181-2/+3
| | | | | | | llvm-cov typically doesn't highlight gap segments, but it should if the gap occurs after an uncovered region in order to preserve continuity. llvm-svn: 316107
* [llvm-cov] Factor out logic to iterate over line coverage stats (NFC)Vedant Kumar2017-10-141-2/+2
| | | | | | | | | | 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] Hide files with no coverage from the index when filtering by nameSean Eveson2017-10-031-2/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D38457 llvm-svn: 314782
* [llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson2017-09-281-5/+5
| | | | | | | | | | | 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-5/+5
| | | | | | | | options" Test failures. llvm-svn: 314314
* [llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson2017-09-271-5/+5
| | | | | | | | | | | 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
* [Coverage] Use gap regions to select better line exec countsVedant Kumar2017-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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] Make some summary info fields private. NFC.Vedant Kumar2017-09-151-9/+10
| | | | | | | | There's a bug in the way the line and region summary objects are merged. It would have been less likely to occur if those objects kept some data private. llvm-svn: 313416
* [llvm-cov] Allow hiding instantiation/region coverage from summary tablesEli Friedman2017-09-111-11/+17
| | | | | | | | | | | | | Region coverage is difficult to explain without going deep into how coverage is implemented. Instantiation coverage is easier to explain, but probably not useful in most cases (templates don't exist in C, and most C++ code contains relatively few templates). This patch adds the options "-show-region-summary" and "-show-instantiation-summary" to allow hiding those columns. "-show-instantiation-summary" is turned off by default. llvm-svn: 312969
* [llvm-cov] Fix a lifetime issueVedant Kumar2017-09-081-1/+1
| | | | | | | This fixes an issue where a std::string was moved to a constructor which accepted a StringRef. llvm-svn: 312816
* [llvm-cov] Unify region marker placement between text/html modesVedant Kumar2017-09-081-12/+8
| | | | | | | | | | | | 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] Rearrange entries in report index.Eli Friedman2017-08-091-11/+40
| | | | | | | | | | | | | | Files which don't contain any functions are likely useless; don't include them in the main table. Put the links at the bottom of the page, in case someone wants to figure out coverage for code inside a macro. Not sure if this is the best solution, but it seems like an improvement. Differential Revision: https://reviews.llvm.org/D36298 llvm-svn: 310518
* [llvm-cov] Avoid 0% when reporting something that's 0/0Alex Lorenz2016-11-211-4/+8
| | | | | | | | | | | | | This commit makes llvm-cov avoid showing 0% (0/0) coverage for things like file function coverage, etc. in reports and HTML output. This can happen for files like headers that have macros but no functions. This commit makes llvm-cov report - (0/0) instead. rdar://29246480 Differential Revision: https://reviews.llvm.org/D26615 llvm-svn: 287539
* [llvm-cov] Turn line numbers in html reports into clickable linksVedant Kumar2016-11-021-3/+5
| | | | llvm-svn: 285853
* [llvm-cov] Do not print out the filename of the object fileVedant Kumar2016-10-251-5/+2
| | | | | | | | | 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] Get rid of all invalid filename referencesVedant Kumar2016-09-231-1/+1
| | | | | | | | | | | | | | We used to append filenames into a vector of std::string, and then append a reference to each string into a separate vector. This made it easier to work with the getUniqueSourceFiles API. But it's buggy. std::string has a small-string optimization, so you can't expect to capture a reference to one if you're copying it into a growing vector. Add a test that triggers this invalid reference to std::string scenario, and kill the issue with fire by just using ArrayRef<std::string> everywhere. llvm-svn: 282281
* [llvm-cov] Minor cleanup. NFC.Vedant Kumar2016-09-231-6/+6
| | | | llvm-svn: 282280
* [llvm-cov] Emit a link to some documentationVedant Kumar2016-09-191-0/+7
| | | | llvm-svn: 281883
* [llvm-cov] Make a helper method static for re-use (NFC)Vedant Kumar2016-09-191-2/+2
| | | | llvm-svn: 281876
* [llvm-cov] Track function and instantiation coverage separatelyVedant Kumar2016-09-191-2/+5
| | | | | | | | | | | | | | | | | | | | These are distinct statistics which are useful to look at separately. Example: say you have a template function "foo" with 5 instantiations and only 3 of them are covered. Then this contributes (1/1) to the total function coverage and (3/5) to the total instantiation coverage. I.e, the old "Function Coverage" column has been renamed to "Instantiation Coverage", and the new "Function Coverage" aggregates information from the various instantiations of a function. One benefit of making this switch is that the Line and Region coverage columns will start making sense. Let's continue the example and assume that the 5 instantiations of "foo" cover {2, 4, 6, 8, 10} out of 10 lines respectively. The new line coverage for "foo" is (10/10), not (30/50). The old scenario got confusing because we'd report that there were more lines in a file than what was actually possible. llvm-svn: 281875
* [llvm-cov] Don't recompute the 'Covered' field from *CoverageInfo (NFC)Vedant Kumar2016-09-191-6/+5
| | | | llvm-svn: 281874
* [llvm-cov] Drop another redundant 'No.' suffixVedant Kumar2016-09-191-1/+1
| | | | llvm-svn: 281872
* [llvm-cov] Move some layout logic to the right spot (NFC)Vedant Kumar2016-09-151-1/+1
| | | | llvm-svn: 281590
* [llvm-cov] Hide instantiation views for unexecuted functionsVedant Kumar2016-09-151-1/+9
| | | | | | | | Copying in the full text of the function doesn't help at all when we already know that it's never executed. Just say that it's unexecuted -- the relevant source text has already been printed. llvm-svn: 281589
* [llvm-cov] Don't create 'jump to ...' links in nested viewsVedant Kumar2016-09-151-1/+1
| | | | | | | Doing so is pointless, since the whole view is usually visible in a small amount of space. llvm-svn: 281588
* [llvm-cov] Make a method name more accurate (NFC)Vedant Kumar2016-09-151-3/+2
| | | | llvm-svn: 281581
* [llvm-cov] Just emit the version number in the index fileVedant Kumar2016-09-131-2/+1
| | | | | | | Having the version information in every view is distracting, especially if there are several sub-views. llvm-svn: 281414
* [llvm-cov] - Included footer "Generated by llvm-cov -- llvm version <version ↵Ying Yi2016-09-131-2/+4
| | | | | | | | | | number>" in the coverage report. The llvm-cov version information will be useful to the user when comparing the code coverage across different versions of llvm-cov. This patch provides the llvm-cov version information in the generated coverage report. Differential Revision: https://reviews.llvm.org/D24457 llvm-svn: 281321
* [llvm-cov] Move the 'jump to first unexecuted line' linkVedant Kumar2016-09-101-14/+15
| | | | | | | 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-54/+21
| | | | | | | - Change the location of the 'Region Coverage' column. - Use less css and text for some labels. llvm-svn: 281145
* [llvm-cov] Remove some asserts in the html renderer (NFC)Vedant Kumar2016-09-091-5/+1
| | | | | | | | | | | These asserts are making tests fragile. The renderer does not enter an invalid state when they fail, however, it may spit out a garbled coverage report because the source text no longer matches the provided coverage mapping. Another follow-up to r281072. llvm-svn: 281076
* [llvm-cov] Emit a summary in the report directory's indexVedant Kumar2016-09-091-21/+105
| | | | | | | | llvm-cov writes out an index file in '-output-dir' mode, albeit not a very informative one. Try to fix that by using the CoverageReport API to include some basic summary information in the index file. llvm-svn: 281011
* [llvm-cov] Fix issues with segment highlighting in the html viewVedant Kumar2016-09-081-16/+10
| | | | | | | | | | | | | The text and html coverage views take different approaches to emitting highlighted regions. That's because this problem is easier in the text view: there's no need to worry about escaping text or adding tooltip content to a highlighted snippet. Unfortunately, the html view didn't get region highlighting quite right. This patch fixes the situation, bringing parity between the two views. llvm-svn: 280981
* [llvm-cov] Use less space to describe source namesVedant Kumar2016-09-081-5/+3
| | | | | | | | 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-6/+1
| | | | | | | | | | 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-3/+12
| | | | | | | | 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] Drop redundant "No." suffix in a column titleVedant Kumar2016-08-311-1/+1
| | | | llvm-svn: 280181
* [llvm-cov] Use the native path in the coverage report.Ying Yi2016-08-301-2/+8
| | | | | | | | | | | 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-11/+88
| | | | | | | | | | | | 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
OpenPOWER on IntegriCloud