summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/llvm-cov.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert r367649: Improve raw_ostream so that you can "write" colors using ↵Rui Ueyama2019-08-021-4/+7
| | | | | | | | operator<< This reverts commit r367649 in an attempt to unbreak Windows bots. llvm-svn: 367658
* Improve raw_ostream so that you can "write" colors using operator<<Rui Ueyama2019-08-021-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. raw_ostream supports ANSI colors so that you can write messages to the termina with colors. Previously, in order to change and reset color, you had to call `changeColor` and `resetColor` functions, respectively. So, if you print out "error: " in red, for example, you had to do something like this: OS.changeColor(raw_ostream::RED); OS << "error: "; OS.resetColor(); With this patch, you can write the same code as follows: OS << raw_ostream::RED << "error: " << raw_ostream::RESET; 2. Add a boolean flag to raw_ostream so that you can disable colored output. If you disable colors, changeColor, operator<<(Color), resetColor and other color-related functions have no effect. Most LLVM tools automatically prints out messages using colors, and you can disable it by passing a flag such as `--disable-colors`. This new flag makes it easy to write code that works that way. Differential Revision: https://reviews.llvm.org/D65564 llvm-svn: 367649
* 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-7/+7
| | | | | | | | | | | | | | | | 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
* 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
* Retry: [llvm-cov] Add support for exporting coverage data to JSONVedant Kumar2016-07-261-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | This enables users to export coverage information as portable JSON for use by analysis tools and storage in document based databases. The export sub-command is invoked just like the others: llvm-cov export -instr-profile path/to/foo.profdata path/to/foo.binary The resulting JSON contains a list of files and functions. Every file object contains a list of segments, expansions, and a summary of the file's region, function, and line coverage. Every function object contains the function's name and regions. There is also a total summary for the entire object file. Changes since the initial commit (r276813): - Fixed the regexes in the tests to handle Windows filepaths. Patch by Eddie Hurtig! Differential Revision: https://reviews.llvm.org/D22651 llvm-svn: 276818
* Revert "[llvm-cov] Add support for exporting coverage data to JSON"Vedant Kumar2016-07-261-9/+3
| | | | | | | | | This reverts commit r276813. The Windows bots are complaining about some of the filename regexes in the tests: http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/5299 llvm-svn: 276816
* [llvm-cov] Add support for exporting coverage data to JSONVedant Kumar2016-07-261-3/+9
| | | | | | | | | | | | | | | | | | | | This enables users to export coverage information as portable JSON for use by analysis tools and storage in document based databases. The export sub-command is invoked just like the others: llvm-cov export -instr-profile path/to/foo.profdata path/to/foo.binary The resulting JSON contains a list of files and functions. Every file object contains a list of segments, expansions, and a summary of the file's region, function, and line coverage. Every function object contains the function's name and regions. There is also a total summary for the entire object file. Patch by Eddie Hurtig! Differential Revision: https://reviews.llvm.org/D22651 llvm-svn: 276813
* Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith2016-06-091-0/+8
| | | | | | | looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
* llvm-cov: Make llvm-cov --version DTRTJustin Bogner2015-06-031-0/+8
| | | | | | | | In r233132 we started requiring a subcommand in llvm-cov, but this made `llvm-cov --version` invalid, which is kind of silly. Print version information in this case, as most people would expect. llvm-svn: 238897
* llvm-cov: Require a subcommand when invoked as llvm-covJustin Bogner2015-03-241-16/+16
| | | | | | | | | | | | | | A while ago llvm-cov gained support for clang's instrumentation based profiling in addition to its gcov support, and subcommands were added to choose which behaviour to use. When no subcommand was specified, we fell back to gcov compatibility with a warning that a subcommand would be required in the future. Now, we require the subcommand. Note that if the basename of llvm-cov is gcov (via symlink or hardlink, for example), we still use the gcov compatible behaviour with no subcommand required. llvm-svn: 233132
* Make helper functions static.Benjamin Kramer2015-03-091-1/+1
| | | | | | Found by -Wmissing-prototypes. NFC. llvm-svn: 231664
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-1/+1
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* llvm-cov: Follow LLVM naming conventionsJustin Bogner2014-10-301-18/+17
| | | | | | This renames a few things that are using an unusual naming convention. llvm-svn: 220929
* llvm-cov: Very basic top level helpJustin Bogner2014-10-301-11/+17
| | | | llvm-svn: 220926
* 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
* 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-221-1/+55
| | | | | | | | | | | | | 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-281-135/+4
| | | | | | | | 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
* llvm-cov: Accept the long forms of gcov optionsJustin Bogner2014-01-291-0/+6
| | | | | | | | | This is a bit imperfect, as these options don't show up in the help as is and single dash variants are accepted, which differs from gcov. Unfortunately, this seems to be as good as it gets with the cl::opt machinery, so it'll do as an incremental step. llvm-svn: 200419
* llvm-cov: Improve help message textJustin Bogner2014-01-291-22/+21
| | | | | | | | This Properly capitalizes and clarifies the help output from llvm-cov. It also puts the llvm-only / non-gcov-compatible options in their own category. llvm-svn: 200418
* llvm-cov: Expect a source file as a positional parameterJustin Bogner2014-01-291-13/+17
| | | | | | | | | | | Currently, llvm-cov isn't command-line compatible with gcov, which accepts a source file name as its first parameter and infers the gcno and gcda file names from that. This change keeps our -gcda and -gcno options available for convenience in overriding this behaviour, but adds the required parameter and inference behaviour as a compatible default. llvm-svn: 200417
* llvm-cov: Added -f option for function summaries.Yuchen Wu2013-12-191-1/+5
| | | | | | | | | | | Similar to the file summaries, the function summaries output line, branching and call statistics. The file summaries have been moved outside the initial loop so that all of the function summaries can be outputted before file summaries. Also updated test cases. llvm-svn: 197633
* llvm-cov: Added -c option for branch counts.Yuchen Wu2013-12-181-3/+7
| | | | | | | | | This will cause llvm-cov to output branch counts instead of branch probabilities. -b must be enabled. Also updated tests. llvm-svn: 197594
* llvm-cov: Added -u option for unconditional branch info.Yuchen Wu2013-12-161-1/+5
| | | | | | | | | Outputs branch information for unconditional branches in addition to conditional branches. -b option must be enabled. Also updated tests. llvm-svn: 197432
* llvm-cov: Added -b option for branch probabilities.Yuchen Wu2013-12-131-2/+6
| | | | | | | | | | | This option tells llvm-cov to print out branch probabilities when a basic block contains multiple branches. It also prints out some function summary info including the number of times the function enters, the percent of time it returns, and how many blocks were executed. Also updated tests. llvm-svn: 197198
* llvm-cov: Added -a option for block data.Yuchen Wu2013-12-101-2/+4
| | | | | | | | | | | | | | | Similar to gcov, llvm-cov will now print out the block count at the end of each block. Multiple blocks can end on the same line. One computational difference is by using -a, llvm-cov will no longer simply add the block counts together to form a line count. Instead, it will take the maximum of the block counts on that line. This has a similar effect to what gcov does, but generates more correct counts in certain scenarios. Also updated tests. llvm-svn: 196856
* llvm-cov: Conformed headers.Yuchen Wu2013-12-051-1/+1
| | | | llvm-svn: 196541
* llvm-cov: Split GCOVFile's read into GCNO and GCDA.Yuchen Wu2013-12-041-2/+2
| | | | | | | | This splits the file-scope read() function into readGCNO() and readGCDA(). Also broke file format read into functions that first read the file type, then check the version. llvm-svn: 196353
* llvm-cov: Removed output to STDOUT/specified file.Yuchen Wu2013-12-031-11/+1
| | | | | | | | | | | | Instead of asking the user to specify a single file to output coverage info and defaulting to STDOUT, llvm-cov now creates files for each source file with a naming system of: <source filename> + ".llcov". This is what gcov does and although it can clutter the working directory with numerous coverage files, it will be easier to hook the llvm-cov output to tools which operate on this assumption (such as lcov). llvm-svn: 196184
* llvm-cov: Clean up memory leaks.Benjamin Kramer2013-11-151-2/+2
| | | | llvm-svn: 194799
* Revert "llvm-cov: Added command-line option to change dir."Yuchen Wu2013-11-051-11/+1
| | | | | | This reverts commit d8acf0078cf363252727acff00f85ae8074f95b3. llvm-svn: 194040
* llvm-cov: Added command-line option to change dir.Yuchen Wu2013-11-051-1/+11
| | | | | | | This will allow for much easier testing when the input files are in a different folder from the test script. llvm-svn: 194034
* Added command-line option to output llvm-cov to file.Yuchen Wu2013-11-021-1/+10
| | | | | | | Added -o option to llvm-cov. If no output file is specified, it defaults to STDOUT. llvm-svn: 193899
* Updated llvm-cov's OVERVIEW descriptionYuchen Wu2013-10-311-1/+1
| | | | llvm-svn: 193732
OpenPOWER on IntegriCloud