1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

58 Commits

Author SHA1 Message Date
Justin Bogner
d27a521c07 Revert "llvm-cov: Remove an overly system specific test"
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
2014-09-11 23:20:48 +00:00
Justin Bogner
40d9fabf30 llvm-cov: Fix a misuse of ArrayRef::slice I introduced in r217430
It appears this code was completely untested, so using ArrayRef wrong
didn't break anything obvious.

llvm-svn: 217476
2014-09-10 06:06:07 +00:00
Justin Bogner
04bf7c7e7c llvm-cov: Use ArrayRef::slice (NFC)
llvm-svn: 217430
2014-09-09 09:15:52 +00:00
Justin Bogner
951fd60695 llvm-cov: Combine two types that were nearly identical (NFC)
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
2014-09-09 05:32:18 +00:00
Justin Bogner
8f071790c7 llvm-cov: Rename MappingRegion to coverage::CountedRegion (NFC)
This name was too similar to CoverageMappingRegion, and the type
really belongs in the coverage library anyway.

llvm-svn: 217416
2014-09-09 05:32:14 +00:00
Justin Bogner
b977873733 llvm-cov: Use ErrorOr rather than an error_code* (NFC)
llvm-svn: 217404
2014-09-08 21:04:00 +00:00
Justin Bogner
bb93be54d8 llvm-cov: Remove dead code
FunctionCoverageMapping::PrettyName was from a version of the tool
during review, and isn't actually used currently.

llvm-svn: 217398
2014-09-08 19:51:21 +00:00
Justin Bogner
a1e018be46 llvm-cov: Don't pointlessly create a unique_ptr (NFC)
There's no ownership going on here, and no reason to heap allocate
this object.

llvm-svn: 217113
2014-09-04 00:04:54 +00:00
Craig Topper
43cee2f5fc Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
llvm-svn: 216525
2014-08-27 05:25:25 +00:00
Patrik Hagglund
079768f99c Silence gcc -Wpedantic.
llvm-svn: 216344
2014-08-24 09:12:33 +00:00
Alex Lorenz
f8361e4518 llvm-cov: add code coverage tool that's based on coverage mapping format and 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
2014-08-22 22:56:03 +00:00
Alex Lorenz
c3030769bd llvm-cov: move the gcov code into a separate file.
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
2014-07-28 18:03:51 +00:00
Rafael Espindola
858b9e1423 Update the MemoryBuffer API to use ErrorOr.
llvm-svn: 212405
2014-07-06 17:43:13 +00:00
Justin Bogner
e30ccae2b9 llvm-cov: Support specifying multiple source files
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
2014-06-27 20:41:25 +00:00
Rafael Espindola
0df15fc77a Finishing touch for the std::error_code transition.
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
2014-06-13 17:20:48 +00:00
Rafael Espindola
5c15b3d369 Remove 'using std::error_code' from tools.
llvm-svn: 210876
2014-06-13 03:07:50 +00:00
Rafael Espindola
e0e308ff6d Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.

llvm-svn: 210835
2014-06-12 21:46:39 +00:00
Rafael Espindola
38dc624425 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.

llvm-svn: 210803
2014-06-12 17:38:55 +00:00
Rafael Espindola
cb080681ac Use std::error_code instead of llvm::error_code.
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
2014-06-11 19:05:50 +00:00
Justin Bogner
b8e01630df 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.

llvm-svn: 208148
2014-05-07 02:11:18 +00:00
Justin Bogner
6f40bf9196 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.

llvm-svn: 207035
2014-04-23 21:44:55 +00:00
Justin Bogner
ed5cd7f12e llvm-cov: Allow short options to be grouped
llvm-svn: 207034
2014-04-23 21:44:48 +00:00
Ahmed Charles
52ce0c101e 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.

llvm-svn: 203083
2014-03-06 05:51:42 +00:00
Justin Bogner
008ac0494e llvm-cov: Support gcov's extermely lenient treatment of -o
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
2014-02-18 09:19:48 +00:00
Justin Bogner
8f223c891e 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.

llvm-svn: 200754
2014-02-04 10:45:02 +00:00
Justin Bogner
65de807c11 llvm-cov: Implement the object-directory flag
llvm-svn: 200741
2014-02-04 06:41:43 +00:00
Justin Bogner
f5d6ae5d00 llvm-cov: Ignore missing .gcda files
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
2014-02-04 06:41:39 +00:00
Justin Bogner
d84fb7d44a llvm-cov: Accept the long forms of gcov options
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
2014-01-29 21:31:47 +00:00
Justin Bogner
f2934ce45c llvm-cov: Improve help message text
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
2014-01-29 21:31:45 +00:00
Justin Bogner
25e1dc7514 llvm-cov: Expect a source file as a positional parameter
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
2014-01-29 21:31:34 +00:00
Yuchen Wu
a7b83f0a43 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.

llvm-svn: 197633
2013-12-19 00:29:25 +00:00
Yuchen Wu
fabdd3701d 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.

llvm-svn: 197594
2013-12-18 18:40:15 +00:00
Yuchen Wu
20daa1c2fa 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.

llvm-svn: 197432
2013-12-16 22:14:02 +00:00
Yuchen Wu
698f3e12b7 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.

llvm-svn: 197198
2013-12-13 01:15:07 +00:00
Yuchen Wu
9e73c842ad 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.

llvm-svn: 196856
2013-12-10 01:02:07 +00:00
Yuchen Wu
d29823e2c3 llvm-cov: Conformed headers.
llvm-svn: 196541
2013-12-05 22:02:29 +00:00
Yuchen Wu
0b08e75d64 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.

llvm-svn: 196353
2013-12-04 04:49:23 +00:00
Yuchen Wu
cd7628e981 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).

llvm-svn: 196184
2013-12-03 00:57:11 +00:00
Benjamin Kramer
0207e765c7 llvm-cov: Clean up memory leaks.
llvm-svn: 194799
2013-11-15 09:44:17 +00:00
NAKAMURA Takumi
03017d65ec llvm-cov requires IR and Support as libraries. Instrumentation would be overkill.
llvm-svn: 194695
2013-11-14 11:45:16 +00:00
Yuchen Wu
2ca00e3a3d Revert "llvm-cov: Added command-line option to change dir."
This reverts commit d8acf0078cf363252727acff00f85ae8074f95b3.

llvm-svn: 194040
2013-11-05 01:56:29 +00:00
Yuchen Wu
f41fb5a06a llvm-cov: Added command-line option to change dir.
This will allow for much easier testing when the input files are in a
different folder from the test script.

llvm-svn: 194034
2013-11-05 01:20:41 +00:00
Yuchen Wu
c01bdb27f5 Added command-line option to output llvm-cov to file.
Added -o option to llvm-cov. If no output file is specified, it defaults
to STDOUT.

llvm-svn: 193899
2013-11-02 00:09:17 +00:00
Yuchen Wu
bd5d7e04ef Updated llvm-cov's OVERVIEW description
llvm-svn: 193732
2013-10-31 02:01:24 +00:00
Bob Wilson
dfa90927ed Change llvm-cov output formatting to be more similar to gcov.
- Replaced tabs with proper padding
- print() takes two arguments, which are the GCNO and GCDA filenames
- Files are listed at the top of output, appended by line 0
- Stripped strings of trailing \0s
- Removed last two lines of whitespace in output

Patch by Yuchen Wu!

llvm-svn: 193148
2013-10-22 05:09:41 +00:00
Bob Wilson
1a96904c72 Move the printing of llvm-cov information out from collectLineCounts().
collectLineCounts() should only organize the output data. This is done in
anticipation of subsequent changes which will pass in GCNO and GCDA filenames
into the print function where it is printed similar to the gcov output.

Patch by Yuchen Wu!

llvm-svn: 193134
2013-10-22 00:09:03 +00:00
Bill Wendling
f455fc4cc9 Remove accidental commit.
llvm-svn: 167544
2012-11-07 18:39:32 +00:00
Bill Wendling
7c037952d4 Add comment describing what's going on here.
llvm-svn: 167525
2012-11-07 05:19:04 +00:00
Daniel Dunbar
30d6a45140 LLVMBuild: Remove trailing newline, which irked me.
llvm-svn: 146409
2011-12-12 19:48:00 +00:00
Daniel Dunbar
efa02a0c3d LLVMBuild: Add description files for the LLVM tools.
llvm-svn: 144417
2011-11-11 22:59:39 +00:00