summaryrefslogtreecommitdiff
path: root/tools/llvm-cov/CodeCoverage.cpp
AgeCommit message (Collapse)Author
2017-12-28Avoid int to string conversion in Twine or raw_ostream contexts.Benjamin Kramer
Some output changes from uppercase hex to lowercase hex, no other functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321526 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-11[llvm-cov] Add an option for "export" command to emit only file summary data.Max Moroz
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320435 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13[llvm-cov] Generate "report" for given source paths if sources are specified.Max Moroz
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315685 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04[llvm-cov] Fix showing title when filtering and not outputting to a directorySean Eveson
Differential Revision: https://reviews.llvm.org/D38507 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314885 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314396 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27Revert "[llvm-cov] Create directory structure when filtering using -name*= ↵Sean Eveson
options" Test failures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314314 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314310 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-25[llvm-cov] Warn if -show-functions is used without query filesVedant Kumar
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314175 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-23[Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner
This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314050 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[llvm-cov] Improve error messaging for function mismatchesVedant Kumar
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313853 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19[llvm-cov] Make report metrics agree with line exec counts, fixes PR34615Vedant Kumar
Use the same logic as the line-oriented coverage view to determine the number of covered lines in a function. Fixes llvm.org/PR34615. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313604 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-13Convenience/safety fix for llvm::sys::Execute(And|No)WaitAlexander Kornienko
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313155 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11[llvm-cov] Allow hiding instantiation/region coverage from summary tablesEli Friedman
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312969 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-08[llvm-cov] Fix a lifetime issueVedant Kumar
This fixes an issue where a std::string was moved to a constructor which accepted a StringRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312816 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-08[llvm-cov] Unify region marker placement between text/html modesVedant Kumar
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312813 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31[llvm-cov] Read in function names for filtering from a text file.Sean Eveson
Summary: Add a -name-whitelist option, which behaves in the same way as -name, but it reads in multiple function names from the given input file(s). Reviewers: vsk Reviewed By: vsk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37111 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312227 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14[llvm-cov] Add an option which maps the location of source directories on ↵Sean Eveson
another machine to your local copies Summary: This patch adds the -path-equivalence option (example: llvm-cov show -path-equivalence=/origin/path,/local/path) which maps the source code path from one machine to another when using `llvm-cov show`. This is similar to the -filename-equivalence option, but doesn't require you to specify all the source files on the command line. This allows you to generate the coverage data on one machine (e.g. in a CI system), and then use llvm-cov on another machine where you have the same code base on a different path. Reviewers: vsk Reviewed By: vsk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36391 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310827 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04[llvm-cov] NFC: make_unique-ify two allocationsVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310011 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02[Coverage] Add an API to retrive all instantiations of a function (NFC)Vedant Kumar
The CoverageMapping::getInstantiations() API retrieved all function records corresponding to functions with more than one instantiation (e.g template functions with multiple specializations). However, there was no simple way to determine *which* function a given record was an instantiation of. This was an oversight, since it's useful to aggregate coverage information over all instantiations of a function. llvm-cov works around this by building a mapping of source locations to instantiation sets, but this duplicates logic that libCoverage already has (see FunctionInstantiationSetCollector). This change adds a new API, CoverageMapping::getInstantiationGroups(), which returns a list of InstantiationGroups. A group contains records for each instantiation of some particular function, and also provides utilities to get the total execution count within the group, the source location of the common definition, etc. This lets removes some hacky logic in llvm-cov by reusing FunctionInstantiationSetCollector and makes the CoverageMapping API friendlier for other clients. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309904 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02[llvm-cov] Respect the value of the -show-instantiations optionVedant Kumar
Make `-show-instantiations=false` actually skip displaying instantiation sub-views, instead of simply ignoring the option. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309903 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01[llvm-cov] Allow specifying distinct architectures for each loaded binaryVedant Kumar
The coverage tool needs to know which slice to look at when it's handed a universal binary. Some projects need to look at aggregate coverage reports for a variety of slices in different binaries: this patch adds support for these kinds of projects to llvm-cov. rdar://problem/33579007 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309747 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11[llvm-cov] Add a cl::opt to control the number of threadsVedant Kumar
When an output directory is specified, llvm-cov spawns some threads to speed up the process of writing out file reports. Add an option which allows users to control how many threads llvm-cov uses. A CommandGuide.rst update + test is included. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307609 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28[llvm-cov] Error-out when an unsupported format is used (PR32087)Vedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296487 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19[llvm-cov] Respect Windows line endings when parsing demangled symbols.Igor Kudrin
Differential Revision: https://reviews.llvm.org/D30096 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295605 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05[llvm-cov] Don't show function summaries when filtering by filename (fixes ↵Vedant Kumar
PR31395) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294137 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05[llvm-cov] Demangle symbols in function summaries (fixes PR31394)Vedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294136 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05[llvm-cov] Refactor logic for storing demangled symbols, NFCVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294135 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05[llvm-cov] Fix a comment, NFCVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294134 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-30Apply clang-tidy's 'performance-faster-string-find' check to LLVM.Benjamin Kramer
No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288235 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-20Fix spelling mistakes in Tools/Tests comments. NFC.Simon Pilgrim
Identified by Pedro Giffuni in PR27636. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287489 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25[llvm-cov] Don't use colored output until we know it's supportedVedant Kumar
CodeCoverageTool::error() depends on CoverageViewOptions::Colors being initialized. Should fix: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/56 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285103 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25[llvm-cov] Add support for loading coverage from multiple objectsVedant Kumar
Differential Revision: https://reviews.llvm.org/D25086 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285088 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25[llvm-cov] Do not print out the filename of the object fileVedant Kumar
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285043 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24Remove TimeValue usage from llvm/SupportPavel Labath
Summary: This is a follow-up to D25416. It removes all usages of TimeValue from llvm/Support library (except for the actual TimeValue declaration), and replaces them with appropriate usages of std::chrono. To facilitate this, I have added small utility functions for converting time points and durations into appropriate OS-specific types (FILETIME, struct timespec, ...). Reviewers: zturner, mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25730 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284966 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19[llvm-cov] Don't spawn a thread unless ThreadCount > 1Vedant Kumar
Initializing a ThreadPool with ThreadCount = 1 spawns a thread even though we don't need to. This is at least slower than it needs to be, and at worst may somehow be exacerbating PR30735 (llvm-cov times out on ARM bots). As a follow-up, I'll try to add logic to llvm::ThreadPool to avoid spawning a thread when ThreadCount = 1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08Turn cl::values() (for enum) from a vararg function to using C++ variadic ↵Mehdi Amini
template The core of the change is supposed to be NFC, however it also fixes what I believe was an undefined behavior when calling: va_start(ValueArgs, Desc); with Desc being a StringRef. Differential Revision: https://reviews.llvm.org/D25342 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283671 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23[llvm-cov] Factor out logic to remove unmapped inputs (NFC)Vedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282286 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23[llvm-cov] Filter away source files that aren't in the coverage mappingVedant Kumar
... so that they don't show up in the index. This came up because polly contains a .git directory and some other unmapped input in its source dir. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282282 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23[llvm-cov] Get rid of all invalid filename referencesVedant Kumar
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282281 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22[llvm-cov] Document some fields in a class (NFC)Vedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282203 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22[llvm-cov] Add the ability to specify directories of input source filesVedant Kumar
We've supported restricting coverage reports to a set of files for a long time. Add support for being able to restrict by entire directories. I suppose this supersedes D20803. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282202 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20[llvm-cov] Demangle names for hidden instantiation viewsVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282020 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15[llvm-cov] Hide instantiation views for unexecuted functionsVedant Kumar
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281589 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-09[llvm-cov] Emit a summary in the report directory's indexVedant Kumar
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281011 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08[llvm-cov] Use less space to describe source namesVedant Kumar
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280896 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-06[llvm-cov] Clean up the summary class, delete dead code (NFC)Vedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280764 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-06[llvm-cov] Add the project summary to the text coverage report for each ↵Ying Yi
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280756 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-30[llvm-cov] Use the native path in the coverage report.Ying Yi
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280061 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-24[llvm-cov] Add the project summary to each source file coverage report.Ying Yi
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279628 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-04[llvm-cov] Add some documentation for the -tab-size optionVedant Kumar
Also, un-hide the cl::opt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277741 91177308-0d34-0410-b5e6-96231b3b80d8