Commit Graph

80 Commits

Author SHA1 Message Date
Alexander Kornienko
cd52a7a381 Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)
Apparently, the style needs to be agreed upon first.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240390 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 09:49:53 +00:00
Alexander Kornienko
cf0db29df2 Fixed/added namespace ending comments using clang-tidy. NFC
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!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240137 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-19 15:57:42 +00:00
Yaron Keren
6e92e7b09a Remove more superfluous .str() and replace std::string concatenation with Twine.
Following r233392, http://llvm.org/viewvc/llvm-project?rev=233392&view=rev.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233555 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 15:42:36 +00:00
Benjamin Kramer
1bfcd1f675 Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232998 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 19:32:43 +00:00
Benjamin Kramer
cab2a096fd [gcov] Move formatBranchInfo into an anonymous namespace.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232949 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 13:59:13 +00:00
Justin Bogner
bdd2212363 llvm-cov: Warn instead of error if a .gcda has arcs from an exit block
Patch by Vanderson M. Rosario. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232443 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-17 00:18:51 +00:00
Justin Bogner
c6945d9e32 llvm-cov: Don't use llvm::outs() in library code
Nothing in lib/ should be using llvm::outs() directly. Thread it in
from the caller instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226961 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 23:09:27 +00:00
Justin Bogner
798383b3ff llvm-cov: Use range-for (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226960 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 22:57:02 +00:00
Justin Bogner
4c61bbe673 llvm-cov: clang-format the GCOV files (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226952 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 22:38:01 +00:00
Justin Bogner
03e3dfd20a GCOV: Make sure that function idents in the .gcda and .gcno match
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221441 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-06 06:55:02 +00:00
Rafael Espindola
8c96862847 Modernize raw_fd_ostream's constructor a bit.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216393 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 18:16:47 +00:00
Rafael Espindola
7cba2a973f Update the MemoryBuffer API to use ErrorOr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212405 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-06 17:43:13 +00:00
Rafael Espindola
4e2b922131 Remove 'using std::errro_code' from lib.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210871 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-13 02:24:39 +00:00
Rafael Espindola
5c792faa0e Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210835 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 21:46:39 +00:00
Rafael Espindola
d5132f9073 Remove system_error.h.
This is a minimal change to remove the header. I will remove the occurrences
of "using std::error_code" in a followup patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210803 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 17:38:55 +00:00
Justin Bogner
459a8aaee2 llvm-cov: Explicitly namespace llvm::make_unique to keep MSVC happy
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208219 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-07 16:01:27 +00:00
Timur Iskhodzhanov
88ab50c237 Work-around MSVS build breakage due to r208148
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208171 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-07 08:52:13 +00:00
Justin Bogner
c92330c18c llvm-cov: Handle missing source files as GCOV does
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208149 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-07 02:11:23 +00:00
Justin Bogner
56d05e468c llvm-cov: Implement --no-output
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208148 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-07 02:11:18 +00:00
Justin Bogner
688567e91c llvm-cov: Fix handling of line zero appearing in a line table
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207866 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-02 20:01:24 +00:00
Justin Bogner
de2703ddfb llvm-cov: Add support for gcov's --long-file-names option
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207035 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 21:44:55 +00:00
David Blaikie
e1c0863d74 Use unique_ptr to manage ownership of GCOVFunctions, Blocks, and Edges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206796 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21 21:40:16 +00:00
Justin Bogner
2a6873fdf3 llvm-cov: Handle functions with no line number
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204863 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 22:03:06 +00:00
Ahmed Charles
f4ccd11075 Replace OwningPtr<T> with std::unique_ptr<T>.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 05:51:42 +00:00
Rafael Espindola
ac69459e0f Replace the F_Binary flag with a F_Text one.
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 :-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202052 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-24 18:20:12 +00:00
Rafael Espindola
843efd49b7 Don't make F_None the default.
This will make it easier to switch the default to being binary files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202042 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-24 15:07:20 +00:00
Justin Bogner
d1cf804de3 llvm-cov: Fix include order in GCOV.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200796 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-04 21:03:17 +00:00
Justin Bogner
01c0550584 llvm-cov: Implement the preserve-paths flag
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200754 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-04 10:45:02 +00:00
Chandler Carruth
974a445bd9 Re-sort all of the includes with ./utils/sort_includes.py so that
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198685 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-07 11:48:04 +00:00
NAKAMURA Takumi
722f58c6b3 GCOV.cpp: Fix format strings, %lf. Don't use %lf to double.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197663 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-19 08:46:28 +00:00
Yuchen Wu
d218959ec5 llvm-cov: Added -f option for function summaries.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197633 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-19 00:29:25 +00:00
Yuchen Wu
8cb0f6e78e llvm-cov: Print coverage summary to STDOUT.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197606 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-18 21:12:51 +00:00
Yuchen Wu
2ceb6aeb66 llvm-cov: s/(.*)Executed/\1Exec/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197595 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-18 18:46:25 +00:00
Yuchen Wu
f6358f3eef llvm-cov: Added -c option for branch counts.
This will cause llvm-cov to output branch counts instead of branch
probabilities. -b must be enabled.

Also updated tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197594 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-18 18:40:15 +00:00
Yuchen Wu
89452cf827 llvm-cov: Added -u option for unconditional branch info.
Outputs branch information for unconditional branches in addition to
conditional branches. -b option must be enabled.

Also updated tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197432 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-16 22:14:02 +00:00
Yuchen Wu
028208d334 llvm-cov: Removed extra semicolon from ;;.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197418 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-16 20:03:11 +00:00
Yuchen Wu
a2639798a8 llvm-cov: Added -b option for branch probabilities.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197198 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 01:15:07 +00:00
NAKAMURA Takumi
2b14080035 GCOV.cpp: Use PRIu64 instead of %lu.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196882 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-10 05:39:40 +00:00
Yuchen Wu
30d5ef51e4 llvm-cov: Added -a option for block data.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196856 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-10 01:02:07 +00:00
Yuchen Wu
7d3a11fd9f llvm-cov: Further improved error messages.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196542 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 22:02:33 +00:00
Yuchen Wu
298c76540e llvm-cov: Conformed headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196541 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 22:02:29 +00:00
Yuchen Wu
54dfc2a2be llvm-cov: Changed extension from .llcov to .gcov.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196530 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 20:45:36 +00:00
Daniel Jasper
bfbf8d3ad8 Un-revert r196358: "llvm-cov: Added support for function checksums."
And add the proper fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196367 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 08:57:17 +00:00
Daniel Jasper
b835a4403a Revert r196358: "llvm-cov: Added support for function checksums."
This currently breaks clang/test/CodeGen/code-coverage.c. The root cause
is that the newly introduced access to Funcs[j] is out of bounds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196365 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 08:23:33 +00:00
Yuchen Wu
2ebea72474 llvm-cov: Added support for function checksums.
The function checksums are hashed from the concatenation of the function
name and line number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196358 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 06:00:17 +00:00
Yuchen Wu
45a5b27d9b llvm-cov: Added checks for ident, checksum, name.
Added additional checks for the Identifier, CfgChecksum and Name for
each GCOVFunction. Also added function names in error messages.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196356 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 05:42:28 +00:00
Yuchen Wu
9bd2991ba0 llvm-cov: Capitalized GCNO and GCDA for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196354 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 05:07:36 +00:00
Yuchen Wu
812ad83e58 llvm-cov: Split GCOVFile's read into GCNO and GCDA.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196353 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 04:49:23 +00:00
Yuchen Wu
d25d7a5cd5 llvm-cov: Cleaned up print() function slightly.
Changed while to for loop. Removed unnecessary if statement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196194 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-03 01:35:31 +00:00
Yuchen Wu
6cd7a3fa79 llvm-cov: Removed output to STDOUT/specified file.
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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196184 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-03 00:57:11 +00:00