summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov
Commit message (Collapse)AuthorAgeFilesLines
* Refactor ExecuteAndWait to take StringRefs.Zachary Turner2018-06-121-6/+5
| | | | | | | | | | | | | | | | | | | This simplifies some code which had StringRefs to begin with, and makes other code more complicated which had const char* to begin with. In the end, I think this makes for a more idiomatic and platform agnostic API. Not all platforms launch process with null terminated c-string arrays for the environment pointer and argv, but the api was designed that way because it allowed easy pass-through for posix-based platforms. There's a little additional overhead now since on posix based platforms we'll be takign StringRefs which were constructed from null terminated strings and then copying them to null terminate them again, but from a readability and usability standpoint of the API user, I think this API signature is strictly better. llvm-svn: 334518
* [FileSystem] Split up the OpenFlags enumeration.Zachary Turner2018-06-072-3/+3
| | | | | | | | | | | | | | | | | This breaks the OpenFlags enumeration into two separate enumerations: OpenFlags and CreationDisposition. The first controls the behavior of the API depending on whether or not the target file already exists, and is not a flags-based enum. The second controls more flags-like values. This yields a more easy to understand API, while also allowing flags to be passed to the openForRead api, where most of the values didn't make sense before. This also makes the apis more testable as it becomes easy to enumerate all the configurations which make sense, so I've added many new tests to exercise all the different values. llvm-svn: 334221
* [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
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-0115-136/+136
| | | | | | | | | | | | | | | | We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
* IWYU llvm-config.h for LLVM_VERSION_STRINGNico Weber2018-04-251-0/+1
| | | | llvm-svn: 330856
* Define InitLLVM to do common initialization all at once.Rui Ueyama2018-04-131-6/+2
| | | | | | | | | | | We have a few functions that virtually all command wants to run on process startup/shutdown. This patch adds InitLLVM class to do that all at once, so that we don't need to copy-n-paste boilerplate code to each llvm command's main() function. Differential Revision: https://reviews.llvm.org/D45602 llvm-svn: 330046
* [llvm-cov] Implement -ignore-filename-regex= option for excluding source files.Max Moroz2018-04-098-16/+63
| | | | | | | | | | | | | | | | | | | Summary: The option is helpful for large projects where it's not feasible to specify sources which user would like to see in the report. Instead, it allows to black-list specific sources via regular expressions (e.g. now it's possible to skip all files that have "test" in its name). This also partially fixes https://bugs.llvm.org/show_bug.cgi?id=34277 Reviewers: vsk, morehouse, liaoyuke Reviewed By: vsk Subscribers: kcc, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D43907 llvm-svn: 329581
* [llvm-cov] Prevent llvm-cov from hanging when a symblink doesn't exist.Max Moroz2018-04-051-4/+8
| | | | | | | | | | | | | | | | | | | | Summary: Previous code hangs indefinitely when trying to iterate through a symbol link file that points to an non-exist directory. This change fixes the bug to make the addCollectedPath function exit ealier and print out correct warning messages. Patch by Yuke Liao (@liaoyuke). Reviewers: Dor1s, vsk Reviewed By: vsk Subscribers: bruno, mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D44960 llvm-svn: 329338
* [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
* [llvm-cov] Skip unnecessary coverage computations for "export -summary-only".Max Moroz2018-01-122-30/+39
| | | | | | | | | | | | | | | | | | | Summary: This speeds up export "summary-only" execution by an order of magnitude or two, depending on number of threads used for prepareFileReports execution. Also includes minor refactoring for splitting render of summary and detailed data in two independent methods. Reviewers: vsk, morehouse Reviewed By: vsk Subscribers: llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D42000 llvm-svn: 322397
* [llvm-cov] Multi-threaded implementation of prepareFileReports method.Max Moroz2018-01-055-33/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Local testing has demonstrated a great speed improvement, compare the following: 1) Existing version: ``` $ time llvm-cov show -format=html -output-dir=report -instr-profile=... ... The tool has been launched: 00:00:00 Loading coverage data: 00:00:00 Get unique source files: 00:00:33 Creating an index out of the source files: 00:00:34 Going into prepareFileReports: 00:00:34 Going to emit summary information for each file: 00:28:55 <-- 28:21 min! Going to emit links to files with no function: 00:28:55 Launching 32 threads for generating HTML files: 00:28:55 real 37m43.651s user 112m5.540s sys 7m39.872s ``` 2) Multi-threaded version with 32 CPUs: ``` $ time llvm-cov show -format=html -output-dir=report -instr-profile=... ... The tool has been launched: 00:00:00 Loading coverage data: 00:00:00 Get unique source files: 00:00:38 Creating an index out of the source files: 00:00:40 Going into prepareFileReports: 00:00:40 Preparing file reports using 32 threads: 00:00:40 # Creating thread tasks for the following number of files: 16422 Going to emit summary information for each file: 00:01:57 <-- 1:17 min! Going to emit links to files with no function: 00:01:58 Launching 32 threads for generating HTML files: 00:01:58 real 11m2.044s user 134m48.124s sys 7m53.388s ``` Reviewers: vsk, morehouse Reviewed By: vsk Subscribers: Dor1s, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D41206 llvm-svn: 321871
* [llvm-cov] Refactor "export" command implementation and add support for SOURCES.Max Moroz2018-01-045-327/+436
| | | | | | | | | | | | | | Summary: Define an interface for Exporter + split JSON exporter into .h and .cpp. Reviewers: vsk, morehouse Reviewed By: vsk Subscribers: llvm-commits, Dor1s, kcc Differential Revision: https://reviews.llvm.org/D41600 llvm-svn: 321815
* Avoid int to string conversion in Twine or raw_ostream contexts.Benjamin Kramer2017-12-281-2/+3
| | | | | | Some output changes from uppercase hex to lowercase hex, no other functionality change intended. llvm-svn: 321526
* Remove redundant includes from tools.Michael Zolotukhin2017-12-132-2/+0
| | | | llvm-svn: 320631
* [llvm-cov] Add an option for "export" command to emit only file summary data.Max Moroz2017-12-113-16/+29
| | | | | | | | | | | | | | Summary: That allows to get the same data as produced by "llvm-cov report", but in JSON format, which is better for further processing by end users. Reviewers: vsk Reviewed By: vsk Differential Revision: https://reviews.llvm.org/D41085 llvm-svn: 320435
* [llvm-cov] Don't render empty region marker linesVedant Kumar2017-11-093-10/+13
| | | | | | | 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-092-11/+12
| | | | | | | | | 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
* GCOV: Move GCOV from IR & Support into ProfileData to fix layeringDavid Blaikie2017-11-031-1/+1
| | | | | | | | This class was split between libIR and libSupport, which breaks under modular code generation. Move it into the one library that uses it, ProfileData, to resolve this issue. llvm-svn: 317366
* [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] Move LineCoverageIterator to libCoverage. NFC.Vedant Kumar2017-10-182-142/+0
| | | | | | | | | | | | | LineCoverageIterator makes it easy for clients of coverage data to determine line execution counts for a file or function. The coverage iteration logic is tricky enough that it really pays not to have multiple copies of it. Hopefully having just one implementation in LLVM will make the iteration logic easier to test, reuse, and update. This commit is NFC but I've added a unit test to go along with it just because it's easy to do now. llvm-svn: 316141
* [llvm-cov] Use the coverage namespace. NFC.Vedant Kumar2017-10-186-22/+24
| | | | | | | 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-182-0/+4
| | | | | | | | | | 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-186-47/+45
| | | | | | | | | 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-182-3/+5
| | | | | | | 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] Add one correction to r315960 (PR34962)Vedant Kumar2017-10-171-7/+6
| | | | | | | | | In r315960, I accidentally assumed that the first line segment is guaranteed to be the non-gap region entry segment (given that one is present). It can actually be any segment on the line, and the test I checked in demonstrates that. llvm-svn: 315963
* [llvm-cov] Remove workaround in line execution count calculation (PR34962)Vedant Kumar2017-10-161-15/+8
| | | | | | | | | | | | | Gap areas make it possible to correctly determine when to use counts from deferred regions. Before gap areas were introduced, llvm-cov needed to use a heuristic to do this: it ignored counts from segments that start, but do not end, on a line. This heuristic breaks down on a simple example (see PR34962). This patch removes the heuristic and picks counts from any region entry segment which isn't a gap area. llvm-svn: 315960
* [llvm-cov] Factor out logic to iterate over line coverage stats (NFC)Vedant Kumar2017-10-145-50/+121
| | | | | | | | | | 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] Generate "report" for given source paths if sources are specified.Max Moroz2017-10-133-2/+13
| | | | | | | | | | | | | | | | Summary: Documentation says that user can specify sources for both "show" and "report" commands. "Show" command respects specified sources, but "report" does not. It is useful to have both "show" and "report" generated for specified sources. Also added tests to for both commands with sources specified. Reviewers: vsk, kcc Reviewed By: vsk Differential Revision: https://reviews.llvm.org/D38860 llvm-svn: 315685
* [llvm-cov] Fix showing title when filtering and not outputting to a directorySean Eveson2017-10-041-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D38507 llvm-svn: 314885
* [llvm-cov] Hide files with no coverage from the index when filtering by nameSean Eveson2017-10-037-12/+14
| | | | | | Differential Revision: https://reviews.llvm.org/D38457 llvm-svn: 314782
* [llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson2017-09-289-53/+84
| | | | | | | | | | | 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-279-84/+53
| | | | | | | | options" Test failures. llvm-svn: 314314
* [llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson2017-09-279-53/+84
| | | | | | | | | | | 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] Improve const-correctness of filters. NFC.Sean Eveson2017-09-272-18/+21
| | | | llvm-svn: 314281
* [llvm-cov] Warn if -show-functions is used without query filesVedant Kumar2017-09-251-2/+9
| | | | | | | | | | llvm-cov's report mode does not print any output when -show-functions is specified and no source files are specified. This can be surprising, so the tool should at least print out an error message when this happens. rdar://problem/34636859 llvm-svn: 314175
* Add section headers to SpecialCaseListsVlad Tsyrklevich2017-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Sanitizer blacklist entries currently apply to all sanitizers--there is no way to specify that an entry should only apply to a specific sanitizer. This is important for Control Flow Integrity since there are several different CFI modes that can be enabled at once. For maximum security, CFI blacklist entries should be scoped to only the specific CFI mode(s) that entry applies to. Adding section headers to SpecialCaseLists allows users to specify more information about list entries, like sanitizer names or other metadata, like so: [section1] fun:*fun1* [section2|section3] fun:*fun23* The section headers are regular expressions. For backwards compatbility, blacklist entries entered before a section header are put into the '[*]' section so that blacklists without sections retain the same behavior. SpecialCaseList has been modified to also accept a section name when matching against the blacklist. It has also been modified so the follow-up change to clang can define a derived class that allows matching sections by SectionMask instead of by string. Reviewers: pcc, kcc, eugenis, vsk Reviewed By: eugenis, vsk Subscribers: vitalybuka, llvm-commits Differential Revision: https://reviews.llvm.org/D37924 llvm-svn: 314170
* [Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner2017-09-231-2/+2
| | | | | | | This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
* [llvm-cov] Improve error messaging for function mismatchesVedant Kumar2017-09-211-1/+15
| | | | | | | | | Passing "-dump" to llvm-cov will now print more detailed information about function hash and counter mismatches. This should make it easier to debug *.profdata files which contain incorrect records, and to debug other scenarios where coverage goes missing due to mismatch issues. llvm-svn: 313853
* [llvm-cov] Make report metrics agree with line exec counts, fixes PR34615Vedant Kumar2017-09-198-125/+124
| | | | | | | | | 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-183-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | 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] Fix a bot failure due to r313417Vedant Kumar2017-09-151-3/+3
| | | | | | | | | There's a type mismatch issue with the arguments to a call to std::min introduced in r313417. http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/11174 llvm-svn: 313422
* [llvm-cov] Avoid over-counting covered lines and regionsVedant Kumar2017-09-152-8/+29
| | | | | | | | | | | | | | | | * 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
* [llvm-cov] Make some summary info fields private. NFC.Vedant Kumar2017-09-155-51/+74
| | | | | | | | 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] Remove a redundant field. NFC.Vedant Kumar2017-09-154-22/+15
| | | | | | | | | | The "NotCovered" fields in the region and line summary structs are redundant. We should remove them to make the code clearer. As a follow-up, the "NotCovered" entries should be removed from the reports as well. llvm-svn: 313415
* Convenience/safety fix for llvm::sys::Execute(And|No)WaitAlexander Kornienko2017-09-131-4/+1
| | | | | | | | | | | | | | | | | | | | Summary: Change the type of the Redirects parameter of llvm::sys::ExecuteAndWait, ExecuteNoWait and other APIs that wrap them from `const StringRef **` to `ArrayRef<Optional<StringRef>>`, which is safer and simplifies the use of these APIs (no more local StringRef variables just to get a pointer to). Corresponding clang changes will be posted as a separate patch. Reviewers: bkramer Reviewed By: bkramer Subscribers: vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D37563 llvm-svn: 313155
* [llvm-cov] Allow hiding instantiation/region coverage from summary tablesEli Friedman2017-09-114-45/+75
| | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud