summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/GCOV.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [gcov] Sort file info before printing itVedant Kumar2017-04-261-3/+7
| | | | | | | | | | | | | The order in which GCOV file info is printed depends on the string hash function. This makes some GCOV tests brittle, because the tests must be updated whenever the hash function changes. Sort the filenames before printing out the file info to solve the problem. This should be relatively cheap. Differential Revision: https://reviews.llvm.org/D32512 llvm-svn: 301371
* Cleanup dump() functions.Matthias Braun2017-01-281-18/+36
| | | | | | | | | | | | | | | | | | We had various variants of defining dump() functions in LLVM. Normalize them (this should just consistently implement the things discussed in http://lists.llvm.org/pipermail/cfe-dev/2014-January/034323.html For reference: - Public headers should just declare the dump() method but not use LLVM_DUMP_METHOD or #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - The definition of a dump method should look like this: #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void MyClass::dump() { // print stuff to dbgs()... } #endif llvm-svn: 293359
* Support: Remove MemoryObject and DataStreamer interfaces.Peter Collingbourne2016-11-021-1/+0
| | | | | | | | These interfaces are no longer used. Differential Revision: https://reviews.llvm.org/D26222 llvm-svn: 285774
* llvm-cov: Fix reading gcov data that does not have function namesJustin Bogner2016-02-081-9/+13
| | | | | | | | | | | | | | | | | | | | | In order for recent gcov versions to read the coverage data, you have to use UseCfgChecksum=true and FunctionNamesInData=false options for coverage profiling pass. This is because gcov is expecting the function section in .gcda to be exactly 3 words in size, containing ident and two checksums. While llvm-cov is compatible with UseCfgChecksum=true, it always expects a function name in .gcda function sections (it's not compatible with FunctionNamesInData=false). Thus it's currently impossible to generate one set of coverage files that works with both gcov and llvm-cov. This change fixes the reading of coverage information to only read the function name if it's present. Patch by Arseny Kapoulkine. Thanks! llvm-svn: 260162
* Fix Clang-tidy readability-redundant-control-flow warnings; other minor fixes.Eugene Zelenko2016-02-021-2/+2
| | | | | | Differential revision: http://reviews.llvm.org/D16793 llvm-svn: 259539
* Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren2016-01-291-3/+3
| | | | | | | | r259192 post commit comment. clang part in r259232, this is the LLVM part of the patch. llvm-svn: 259240
* Rename one of our two llvm::GCOVOptions classes to llvm::GCOV::Options. We usedRichard Smith2015-10-141-2/+2
| | | | | | | to get away with this because llvm/Support/GCOV.h was an implementation detail of the llvm-gcov tool, but it's now being used by FDO. llvm-svn: 250258
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-1/+1
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-1/+1
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* Remove more superfluous .str() and replace std::string concatenation with Twine.Yaron Keren2015-03-301-1/+1
| | | | | | Following r233392, http://llvm.org/viewvc/llvm-project?rev=233392&view=rev. llvm-svn: 233555
* Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used.Benjamin Kramer2015-03-231-0/+1
| | | | llvm-svn: 232998
* [gcov] Move formatBranchInfo into an anonymous namespace.Benjamin Kramer2015-03-231-1/+1
| | | | | | NFC. llvm-svn: 232949
* llvm-cov: Warn instead of error if a .gcda has arcs from an exit blockJustin Bogner2015-03-171-1/+3
| | | | | | Patch by Vanderson M. Rosario. Thanks! llvm-svn: 232443
* llvm-cov: Don't use llvm::outs() in library codeJustin Bogner2015-01-231-41/+43
| | | | | | | Nothing in lib/ should be using llvm::outs() directly. Thread it in from the caller instead. llvm-svn: 226961
* llvm-cov: Use range-for (NFC)Justin Bogner2015-01-231-49/+21
| | | | llvm-svn: 226960
* llvm-cov: clang-format the GCOV files (NFC)Justin Bogner2015-01-231-85/+133
| | | | llvm-svn: 226952
* GCOV: Make sure that function idents in the .gcda and .gcno matchJustin Bogner2014-11-061-1/+2
| | | | | | | | | | | | | | When generating gcov compatible profiling, we sometimes skip emitting data for functions for one reason or another. However, this was emitting different function IDs in the .gcno and .gcda files, because the .gcno case was using the loop index before skipping functions and the .gcda the array index after. This resulted in completely invalid gcov data. This fixes the problem by making the .gcno loop track the ID separately from the loop index. llvm-svn: 221441
* Modernize raw_fd_ostream's constructor a bit.Rafael Espindola2014-08-251-5/+5
| | | | | | | | | | Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. llvm-svn: 216393
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-2/+6
| | | | llvm-svn: 212405
* Remove 'using std::errro_code' from lib.Rafael Espindola2014-06-131-2/+1
| | | | llvm-svn: 210871
* 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
* llvm-cov: Explicitly namespace llvm::make_unique to keep MSVC happyJustin Bogner2014-05-071-4/+2
| | | | | | | | This is a followup to r208171, where a call to make_unique was disambiguated for MSVC. Disambiguate two more calls, and remove the comment about it since this is what we do everywhere. llvm-svn: 208219
* Work-around MSVS build breakage due to r208148Timur Iskhodzhanov2014-05-071-2/+4
| | | | llvm-svn: 208171
* llvm-cov: Handle missing source files as GCOV doesJustin Bogner2014-05-071-13/+29
| | | | | | | | | | | If the source files referenced by a gcno file are missing, gcov outputs a coverage file where every line is simply /*EOF*/. This also occurs for lines in the coverage that are past the end of a file that is found. This change mimics gcov. llvm-svn: 208149
* llvm-cov: Implement --no-outputJustin Bogner2014-05-071-15/+43
| | | | | | | | 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: Fix handling of line zero appearing in a line tableJustin Bogner2014-05-021-6/+18
| | | | | | | | | | | | | Reading line tables in llvm-cov was pretty broken, but would happen to work as long as no line in the table was 0. It's not clear to me whether a line of zero *should* show up in these tables, but deciding to read a string in the middle of the line table is certainly the wrong thing to do if it does. I've also added some comments, as trying to figure out what this block of code was doing was fairly unpleasant. llvm-svn: 207866
* llvm-cov: Add support for gcov's --long-file-names optionJustin Bogner2014-04-231-5/+9
| | | | | | | | 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
* Use unique_ptr to manage ownership of GCOVFunctions, Blocks, and Edges.David Blaikie2014-04-211-36/+21
| | | | llvm-svn: 206796
* llvm-cov: Handle functions with no line numberJustin Bogner2014-03-261-0/+5
| | | | | | | | | Functions may in an instrumented binary but not in the original source when they're inserted by the compiler or the runtime. These functions aren't meaningful to the user, so teach llvm-cov to skip over them instead of crashing. llvm-svn: 204863
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-2/+1
| | | | | | | | | | 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
* Replace the F_Binary flag with a F_Text one.Rafael Espindola2014-02-241-1/+1
| | | | | | | | | After this I will set the default back to F_None. The advantage is that before this patch forgetting to set F_Binary would corrupt a file on windows. Forgetting to set F_Text produces one that cannot be read in notepad, which is a better failure mode :-) llvm-svn: 202052
* Don't make F_None the default.Rafael Espindola2014-02-241-1/+1
| | | | | | This will make it easier to switch the default to being binary files. llvm-svn: 202042
* llvm-cov: Fix include order in GCOV.cppJustin Bogner2014-02-041-3/+3
| | | | llvm-svn: 200796
* llvm-cov: Implement the preserve-paths flagJustin Bogner2014-02-041-10/+49
| | | | | | | | | | | | | | | | 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
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-071-1/+1
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
* GCOV.cpp: Fix format strings, %lf. Don't use %lf to double.NAKAMURA Takumi2013-12-191-3/+3
| | | | llvm-svn: 197663
* llvm-cov: Added -f option for function summaries.Yuchen Wu2013-12-191-15/+81
| | | | | | | | | | | 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: Print coverage summary to STDOUT.Yuchen Wu2013-12-181-3/+38
| | | | | | | | | | | | File summaries will now be optionally outputted which will give line, branching and call coverage info. Unfortunately, clang's current instrumentation does not give enough information to deduce function calls, something that gcc is able to do. Thus, no calls are always outputted to be consistent with gcov output. Also updated tests. llvm-svn: 197606
* llvm-cov: s/(.*)Executed/\1Exec/Yuchen Wu2013-12-181-3/+3
| | | | llvm-svn: 197595
* llvm-cov: Added -c option for branch counts.Yuchen Wu2013-12-181-11/+30
| | | | | | | | | 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-8/+18
| | | | | | | | | Outputs branch information for unconditional branches in addition to conditional branches. -b option must be enabled. Also updated tests. llvm-svn: 197432
* llvm-cov: Removed extra semicolon from ;;.Yuchen Wu2013-12-161-1/+1
| | | | llvm-svn: 197418
* llvm-cov: Added -b option for branch probabilities.Yuchen Wu2013-12-131-22/+135
| | | | | | | | | | | 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
* GCOV.cpp: Use PRIu64 instead of %lu.NAKAMURA Takumi2013-12-101-1/+1
| | | | llvm-svn: 196882
* llvm-cov: Added -a option for block data.Yuchen Wu2013-12-101-3/+30
| | | | | | | | | | | | | | | 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: Further improved error messages.Yuchen Wu2013-12-051-5/+7
| | | | llvm-svn: 196542
* llvm-cov: Conformed headers.Yuchen Wu2013-12-051-1/+1
| | | | llvm-svn: 196541
* llvm-cov: Changed extension from .llcov to .gcov.Yuchen Wu2013-12-051-1/+1
| | | | llvm-svn: 196530
* Un-revert r196358: "llvm-cov: Added support for function checksums."Daniel Jasper2013-12-041-3/+9
| | | | | | And add the proper fix. llvm-svn: 196367
OpenPOWER on IntegriCloud