summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove bogus std::error_code returns form SectionRef.Rafael Espindola2014-10-081-2/+1
| | | | | | | | | | | | | | There are two methods in SectionRef that can fail: * getName: The index into the string table can be invalid. * getContents: The section might point to invalid contents. Every other method will always succeed and returning and std::error_code just complicates the code. For example, a section can have an invalid alignment, but if we are able to get to the section structure at all and create a SectionRef, we will always be able to read that invalid alignment. llvm-svn: 219314
* llvm-cov/CoverageReport.cpp: Quick fix for msvcrt, since width specifier "z" ↵NAKAMURA Takumi2014-10-011-12/+12
| | | | | | | | is unavailable. Note, mingw uses its own printf instead of msvcrt. llvm-svn: 218723
* llvm-cov: Use the number of executed functions for the function coverage metric.Alex Lorenz2014-09-304-21/+24
| | | | | | | | This commit fixes llvm-cov's function coverage metric by using the number of executed functions instead of the number of fully covered functions. Differential Revision: http://reviews.llvm.org/D5196 llvm-svn: 218672
* llvm-cov: Allow creating CoverageMappings from filenamesJustin Bogner2014-09-201-18/+1
| | | | llvm-svn: 218185
* llvm-cov: Disentangle the coverage data logic from the display (NFC)Justin Bogner2014-09-2012-477/+137
| | | | | | | | | | 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: Move some reader debug output out of the tool.Justin Bogner2014-09-201-11/+0
| | | | | | | This debug output is really for testing CoverageMappingReader, not the llvm-cov tool. Move it to where it can be more useful. llvm-svn: 218183
* llvm-cov: Return unique_ptrs instead of filling objects (NFC)Justin Bogner2014-09-191-53/+62
| | | | | | | Having create* functions return the object they create is more readable than using an in-out parameter. llvm-svn: 218139
* 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
* llvm-cov: Generalize -filename-equivalenceJustin Bogner2014-09-191-29/+51
| | | | | | | | | | | | | | The filename-equivalence flag allows you to show coverage when your source files don't have the same full paths as those that generated the data. This is mostly useful for writing tests in a cross-platform way. This wasn't triggering in cases where the filename was derived directly from the coverage data, which meant certain types of test case were impossible to write. This patch fixes that, and following patches involve tests that need this. llvm-svn: 218108
* llvm-cov: Simplify FunctionInstantiationSetCollector (NFC)Justin Bogner2014-09-181-28/+15
| | | | | | | | | - Replace std::unordered_map with DenseMap - Use std::pair instead of manually combining two unsigneds - Assert if insert is called with invalid arguments - Avoid an unnecessary copy of a std::vector llvm-svn: 218074
* Alternative (to r216344) fix of gcc -Wpedantic.Patrik Hagglund2014-09-181-1/+1
| | | | | | | | | | | | | | As suggested by David Blaikie, this may be easier to read. The original warning was: ../tools/llvm-cov/llvm-cov.cpp:53:49: error: ISO C++ forbids zero-size array 'argv' [-Werror=pedantic] std::string Invocation(std::string(argv[0]) + " " + argv[1]); It seems to be the case that GCC's warning gets confused and thinks 'argv' is a declaration here. GCC bugzilla issue #61259. llvm-svn: 218048
* llvm-cov: Push some more debug output into the View (NFC)Justin Bogner2014-09-172-24/+4
| | | | llvm-svn: 217984
* llvm-cov: Rework the API for getting the coverage of a file (NFC)Justin Bogner2014-09-176-362/+231
| | | | | | | | | | | | 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
* LineIterator: Provide a variant that keeps blank linesJustin Bogner2014-09-171-8/+4
| | | | | | | | It isn't always useful to skip blank lines, as evidenced by the somewhat awkward use of line_iterator in llvm-cov. This adds a knob to control whether or not to skip blanks. llvm-svn: 217960
* llvm-cov: Fix a typoJustin Bogner2014-09-171-1/+1
| | | | | | | It doesn't make sense for this default parameter to be false, since false makes the function a no-op. llvm-svn: 217945
* 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-173-113/+108
| | | | | | | | | | | | | 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-162-20/+19
| | | | | | | 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: Make debug output more consistentJustin Bogner2014-09-152-16/+16
| | | | | | | | This changes the debug output of the llvm-cov tool to consistently write to stderr, and moves the highlighting output closer to where it's relevant. llvm-svn: 217838
* llvm-cov: Fix an issue with showing regions but not countsJustin Bogner2014-09-152-13/+24
| | | | | | | | | | | 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-153-44/+29
| | | | | | | 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: Simplify CounterMappingRegion, pushing logic to its userJustin Bogner2014-09-151-3/+6
| | | | | | | | | A single function in SourceCoverageDataManager was the only user of some of the comparisons in CounterMappingRegion, and at this point we know that only one file is relevant. This lets us use slightly simpler logic directly in the client. llvm-svn: 217745
* llvm-cov: Move FunctionCoverageMapping into CoverageMapping.h (NFC)Justin Bogner2014-09-127-47/+9
| | | | llvm-svn: 217657
* Revert "llvm-cov: Remove an overly system specific test"Justin Bogner2014-09-111-1/+1
| | | | | | | | | | This fixes a call to sys::fs::equivalent that should've been to CodeCoverageTool::equivalentFiles, which lets us restore the test of r217476 that was removed in r217478. This reverts r217478, but the test works this time. llvm-svn: 217646
* llvm-cov: Fix a misuse of ArrayRef::slice I introduced in r217430Justin Bogner2014-09-101-1/+1
| | | | | | | It appears this code was completely untested, so using ArrayRef wrong didn't break anything obvious. llvm-svn: 217476
* llvm-cov: Use ArrayRef::slice (NFC)Justin Bogner2014-09-091-2/+1
| | | | llvm-svn: 217430
* llvm-cov: Combine two types that were nearly identical (NFC)Justin Bogner2014-09-094-87/+40
| | | | | | | | | llvm-cov had a SourceRange type that was nearly identical to a CountedRegion except that it shaved off a couple of fields. There aren't likely to be enough of these for the minor memory savings to be worth the extra complexity here. llvm-svn: 217417
* llvm-cov: Rename MappingRegion to coverage::CountedRegion (NFC)Justin Bogner2014-09-095-58/+49
| | | | | | | This name was too similar to CoverageMappingRegion, and the type really belongs in the coverage library anyway. llvm-svn: 217416
* llvm-cov: Use ErrorOr rather than an error_code* (NFC)Justin Bogner2014-09-081-4/+4
| | | | llvm-svn: 217404
* llvm-cov: Remove dead codeJustin Bogner2014-09-084-10/+7
| | | | | | | FunctionCoverageMapping::PrettyName was from a version of the tool during review, and isn't actually used currently. llvm-svn: 217398
* llvm-cov: Don't pointlessly create a unique_ptr (NFC)Justin Bogner2014-09-041-9/+7
| | | | | | | There's no ownership going on here, and no reason to heap allocate this object. llvm-svn: 217113
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-271-1/+1
| | | | | | just letting them be implicitly created. llvm-svn: 216525
* Silence gcc -Wpedantic.Patrik Hagglund2014-08-241-1/+1
| | | | llvm-svn: 216344
* llvm-cov: add code coverage tool that's based on coverage mapping format and ↵Alex Lorenz2014-08-2221-4/+2558
| | | | | | | | | | | | | 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
* llvm-cov: move the gcov code into a separate file.Alex Lorenz2014-07-283-135/+158
| | | | | | | | The gcov compatible code is moved to its own file and llvm-cov is updated to be a wrapper that always calls the gcov main function. llvm-svn: 214107
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-9/+11
| | | | llvm-svn: 212405
* llvm-cov: Support specifying multiple source filesJustin Bogner2014-06-271-26/+31
| | | | | | | | | Make llvm-cov compatible with gcov for cases where multiple files are specified on the command line. That is, loop over each one and report coverage, and report errors on stderr only rather than via return code. llvm-svn: 211959
* Finishing touch for the std::error_code transition.Rafael Espindola2014-06-131-1/+2
| | | | | | | | | | | While std::error_code itself seems to work OK in all platforms, there are few annoying differences with regards to the std::errc enumeration. This patch adds a simple llvm enumeration, which will hopefully avoid build breakages in other platforms and surprises as we get more uses of std::error_code. llvm-svn: 210920
* Remove 'using std::error_code' from tools.Rafael Espindola2014-06-131-3/+2
| | | | llvm-svn: 210876
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* Remove system_error.h.Rafael Espindola2014-06-121-1/+1
| | | | | | | This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch. llvm-svn: 210803
* Use std::error_code instead of llvm::error_code.Rafael Espindola2014-06-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea of this patch is to turn llvm/Support/system_error.h into a transitional header that just brings in the erorr_code api to the llvm namespace. I will remove it shortly afterwards. The cases where the general idea needed some tweaking: * std::errc is a namespace in msvc, so we cannot use "using std::errc". I could add an #ifdef, but there were not that many uses, so I just added std:: to them in this patch. * Template specialization had to be moved to the std namespace in this patch set already. * The msvc implementation of default_error_condition doesn't seem to provide the same transformations as we need. Not too surprising since the standard doesn't actually say what "equivalent" means. I fixed the problem by keeping our old mapping and using it at error_code construction time. Despite these shortcomings I think this is still a good thing. Some reasons: * The different implementations of system_error might improve over time. * It removes 925 lines of code from llvm already. * It removes 6313 bytes from the text segment of the clang binary when it is built with gcc and 2816 bytes when building with clang and libstdc++. llvm-svn: 210687
* llvm-cov: Implement --no-outputJustin Bogner2014-05-071-1/+5
| | | | | | | | In gcov, there's a -n/--no-output option, which disables the writing of any .gcov files, so that it emits only the summary info on stdout. This implements the same behaviour in llvm-cov. llvm-svn: 208148
* llvm-cov: Add support for gcov's --long-file-names optionJustin Bogner2014-04-231-2/+6
| | | | | | | | GCOV provides an option to prepend output file names with the source file name, to disambiguate between covered data that's included from multiple sources. Add a flag to llvm-cov that does the same. llvm-svn: 207035
* llvm-cov: Allow short options to be groupedJustin Bogner2014-04-231-6/+6
| | | | llvm-svn: 207034
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-3/+2
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* llvm-cov: Support gcov's extermely lenient treatment of -oJustin Bogner2014-02-181-4/+14
| | | | | | | | | | | | In gcov, the -o flag can accept either a directory or a file name. When given a directory, the gcda and gcno files are expected to be in that directory. When given a file, the gcda and gcno files are expected to be named based on the stem of that file. Non-existent paths are treated as files. This implements compatible behaviour. llvm-svn: 201555
* llvm-cov: Implement the preserve-paths flagJustin Bogner2014-02-041-1/+5
| | | | | | | | | | | | | | | | Until now, when a path in a gcno file included a directory, we would emit our .gcov file in that directory, whereas gcov always emits the file in the current directory. In doing so, this implements gcov's strange name-mangling -p flag, which is needed to avoid clobbering files when two with the same name exist in different directories. The path mangling is a bit ugly and only handles unix-like paths, but it's simple, and it doesn't make any guesses as to how it should behave outside of what gcov documents. If we decide this should be cross platform later, we can consider the compatibility implications then. llvm-svn: 200754
* llvm-cov: Implement the object-directory flagJustin Bogner2014-02-041-2/+13
| | | | llvm-svn: 200741
* llvm-cov: Ignore missing .gcda filesJustin Bogner2014-02-041-7/+12
| | | | | | | | When gcov is run without gcda data, it acts as if the counts are all zero and labels the file as - to indicate that there was no data. We should do the same. llvm-svn: 200740
OpenPOWER on IntegriCloud