summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/SourceCoverageView.h
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-011-32/+32
| | | | | | | | | | | | | | | | 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
* [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
* [llvm-cov] Use the coverage namespace. NFC.Vedant Kumar2017-10-181-9/+10
| | | | | | | 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-8/+6
| | | | | | | | | 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] Hide files with no coverage from the index when filtering by nameSean Eveson2017-10-031-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D38457 llvm-svn: 314782
* [llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson2017-09-281-2/+4
| | | | | | | | | | | 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-4/+2
| | | | | | | | options" Test failures. llvm-svn: 314314
* [llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson2017-09-271-2/+4
| | | | | | | | | | | 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-14/+1
| | | | | | | | | 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
* [llvm-cov] Unify region marker placement between text/html modesVedant Kumar2017-09-081-1/+1
| | | | | | | | | | | | 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-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove duplicated default move ctors/move assign. No functional change.Benjamin Kramer2016-10-271-9/+0
| | | | llvm-svn: 285302
* [llvm-cov] Do not print out the filename of the object fileVedant Kumar2016-10-251-4/+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] 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] Make a method name more accurate (NFC)Vedant Kumar2016-09-151-3/+3
| | | | llvm-svn: 281581
* [llvm-cov] Move the 'jump to first unexecuted line' linkVedant Kumar2016-09-101-4/+4
| | | | | | | 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] Emit a summary in the report directory's indexVedant Kumar2016-09-091-1/+2
| | | | | | | | 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] Constify some methods (NFC)Vedant Kumar2016-09-091-2/+2
| | | | llvm-svn: 281010
* [llvm-cov] Use less space to describe source namesVedant Kumar2016-09-081-10/+7
| | | | | | | | 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/+3
| | | | | | | | | | 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/+5
| | | | | | | | 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] Add the project summary to each source file coverage report.Ying Yi2016-08-241-4/+16
| | | | | | | | | | | | 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] Use relative paths to the stylesheet (for html reports)Vedant Kumar2016-07-211-2/+2
| | | | | | | | | | This makes it easy to swap out the default stylesheet for a custom one. It also shaves ~6.62 MB out of the report directory for a full coverage build of llvm+clang. While we're at it, prune the CSS and add tests for it. llvm-svn: 276359
* [llvm-cov] Use relative paths to file reports in -output-dir modeVedant Kumar2016-06-291-2/+4
| | | | | | This makes it possible to e.g copy a report to another filesystem. llvm-svn: 274173
* [llvm-cov] Minor cleanups to prepare for the html format patchVedant Kumar2016-06-291-1/+16
| | | | | | | | | | | | - 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
* [llvm-cov] Create an index of reports in -output-dir modeVedant Kumar2016-06-281-26/+49
| | | | | | | | | | 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
* Reapply "[llvm-cov] Add an -output-dir option for the show sub-command""Vedant Kumar2016-06-281-1/+26
| | | | | | | | | | | | | | | 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-20/+1
| | | | | | | 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-1/+20
| | | | | | | | | | | 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] Simplify the way expansion views are rendered (NFC)Vedant Kumar2016-06-261-7/+8
| | | | | | | | | 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-6/+8
| | | | | | | 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-7/+10
| | | | llvm-svn: 273772
* [llvm-cov] Separate presentation logic from formatting logic, NFCVedant Kumar2016-06-251-28/+62
| | | | | | | | | | 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] Add SourceNames to SourceCoverageViews, NFCVedant Kumar2016-06-241-2/+21
| | | | | | | | | | | | | 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-23/+23
| | | | | | | | | | | | 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
* Move coverage related code into a separate library.Easwaran Raman2016-04-291-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D19333 llvm-svn: 268089
* InstrProf: Teach llvm-cov to show the max count instead of the lastJustin Bogner2015-02-231-4/+3
| | | | | | | | | | | | When multiple regions start on the same line, llvm-cov was just showing the count of the last one as the line count. This can be confusing and misleading for things like one-liner loops, where the count at the end isn't very interesting, or even "if" statements with an opening brace at the end of the line. Instead, use the maximum of all of the region start counts. llvm-svn: 230263
* llvm-cov: Disentangle the coverage data logic from the display (NFC)Justin Bogner2014-09-201-14/+9
| | | | | | | | | | 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: Rework the API for getting the coverage of a file (NFC)Justin Bogner2014-09-171-80/+15
| | | | | | | | | | | | This encapsulates how we handle the coverage regions of a file or function. In the old model, the user had to deal with nested regions, so they needed to maintain their own auxiliary data structures to get any useful information out of this. The new API provides a sequence of non-overlapping coverage segments, which makes it possible to render coverage information in a single pass and avoids a fair amount of extra work. llvm-svn: 217975
* Add move constructors/assignment to make MSVC happy after r217940Justin Bogner2014-09-171-0/+16
| | | | llvm-svn: 217941
* llvm-cov: Distinguish expansion/instantiation from SourceCoverageViewJustin Bogner2014-09-171-35/+47
| | | | | | | | | | | | | SourceCoverageView currently has "Kind" and a list of child views, all of which must have either an expansion or an instantiation Kind. In addition to being an error-prone design, this makes it awkward to differentiate between the two child types and adds a number of optionally used members to the type. Split the subview types into their own separate objects, and maintain lists of each rather than one combined "Children" list. llvm-svn: 217940
* llvm-cov: Rename a variable and clean up its usageJustin Bogner2014-09-161-2/+2
| | | | | | | Offset is a terrible name for an indentation / nesting level, and it confuses me every time I look at this code. llvm-svn: 217861
* llvm-cov: Fix an issue with showing regions but not countsJustin Bogner2014-09-151-0/+3
| | | | | | | | | | | In r217746, though it was supposed to be NFC, I broke llvm-cov's handling of showing regions without showing counts. This should've shown up in the existing tests, except they were checking debug output that was displayed regardless of what was actually output. I've moved the relevant debug output to a more appropriate place so that the tests catch this kind of thing. llvm-svn: 217835
* llvm-cov: Clean up some redundancy in the view API (NFC)Justin Bogner2014-09-151-20/+8
| | | | | | | This removes the need to pass a starting and ending line when creating a SourceCoverageView, since these are easy to determine. llvm-svn: 217746
* llvm-cov: add code coverage tool that's based on coverage mapping format and ↵Alex Lorenz2014-08-221-0/+213
clang's pgo. This commit expands llvm-cov's functionality by adding support for a new code coverage tool that uses LLVM's coverage mapping format and clang's instrumentation based profiling. The gcov compatible tool can be invoked by supplying the 'gcov' command as the first argument, or by modifying the tool's name to end with 'gcov'. Differential Revision: http://reviews.llvm.org/D4445 llvm-svn: 216300
OpenPOWER on IntegriCloud