1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00
Commit Graph

153 Commits

Author SHA1 Message Date
Vedant Kumar
8dcdf50bb1 Minor formatting change, NFC
The rest of llvm-cov does not use LLVM_ATTRIBUTE_UNUSED. Leave unused
params unnamed to be consistent.

llvm-svn: 274694
2016-07-06 22:02:55 +00:00
Vedant Kumar
c62c146db0 [llvm-cov] Add support for creating html reports
Based on a patch by Harlan Haskins!

Differential Revision: http://reviews.llvm.org/D18278

llvm-svn: 274688
2016-07-06 21:44:05 +00:00
Vedant Kumar
c8e68bf5bb [llvm-cov] Use relative paths to file reports in -output-dir mode
This makes it possible to e.g copy a report to another filesystem.

llvm-svn: 274173
2016-06-29 21:55:46 +00:00
Vedant Kumar
6a9170ee39 Use LLVM_ATTRIBUTE_UNUSED instead of void casts; NFC
llvm-svn: 274139
2016-06-29 16:56:46 +00:00
Vedant Kumar
ad01de17dd [llvm-cov] Do not allow ".." to escape the coverage sub-directory
In -output-dir mode, file reports are placed into a "coverage"
directory. If filenames in the coverage mapping contain "..", they might
escape out of this directory.

Fix the problem by removing ".." from source filenames (expand the path
component).

llvm-svn: 274135
2016-06-29 16:22:12 +00:00
Vedant Kumar
8a4b0078c7 [llvm-cov] Minor cleanups to prepare for the html format patch
- Add renderView{Header,Footer}, renderLineSuffix, and hasSubViews to
  support creating tables with nested views.

- Move the 'Format' cl::opt to make it easier to extend.

- Just create one function view file, instead of overwriting the same
  file for every new function. Add a regression test for this.

llvm-svn: 274086
2016-06-29 00:38:21 +00:00
Simon Pilgrim
bf06d6dbbf Fix "not all control paths return a value" warning on MSVC
llvm-svn: 274065
2016-06-28 21:02:41 +00:00
Vedant Kumar
ca06df5ef5 [llvm-cov] Create an index of reports in -output-dir mode
This index lists the reports available in the 'coverage' sub-directory.
This will help navigate coverage output from large projects.

This commit factors the file creation code out of SourceCoverageView and
into CoveragePrinter.

llvm-svn: 274029
2016-06-28 16:12:24 +00:00
Vedant Kumar
51094a5889 [llvm-cov] Minor cleanups (NFC)
- Test the '-o' alias for -output-dir.
- Use a helper method in a conditional.
- Add a period.

llvm-svn: 274028
2016-06-28 16:12:20 +00:00
Vedant Kumar
22e46a6b65 [llvm-cov] Avoid copying file paths multiple times (NFC)
llvm-svn: 274027
2016-06-28 16:12:18 +00:00
Vedant Kumar
6b51d9f9f3 [llvm-cov] Rename ShowFormat to Format (NFC)
This makes it a bit more generic, in case we want to emit summary
reports in different formats in the future.

llvm-svn: 274026
2016-06-28 16:12:15 +00:00
Vedant Kumar
eb92c94b10 [llvm-cov] Move a check into a helper method (NFC)
llvm-svn: 274025
2016-06-28 16:12:12 +00:00
Simon Pilgrim
51f5a64a7b Fix "not all control paths return a value" warning on MSVC
llvm-svn: 274011
2016-06-28 12:55:35 +00:00
Vedant Kumar
d206ece55d [llvm-cov] Simplify; NFC
llvm-svn: 273988
2016-06-28 03:37:56 +00:00
Vedant Kumar
d930dacca2 Reapply "[llvm-cov] Add an -output-dir option for the show sub-command""
Passing -output-dir path/to/dir to llvm-cov show creates path/to/dir if
it doesn't already exist, and prints reports into that directory.

In function view mode, all views are written into
path/to/dir/functions.$EXTENSION. In file view mode, all views are
written into path/to/dir/coverage/$PATH.$EXTENSION.

Changes since the initial commit:

- Avoid accidentally closing stdout twice.

llvm-svn: 273985
2016-06-28 02:09:39 +00:00
Vedant Kumar
b17e17f6e8 Revert "[llvm-cov] Add an -output-dir option for the show sub-command"
This reverts commit r273971. test/profile/instrprof-visibility.cpp is
failing because of an uncaught error in SafelyCloseFileDescriptor.

llvm-svn: 273978
2016-06-28 01:14:04 +00:00
Vedant Kumar
3caefadc32 [llvm-cov] Add an -output-dir option for the show sub-command
Passing -output-dir path/to/dir to llvm-cov show creates path/to/dir if
it doesn't already exist, and prints reports into that directory.

In function view mode, all views are written into
path/to/dir/functions.$EXTENSION. In file view mode, all views are
written into path/to/dir/coverage/$PATH.$EXTENSION.

llvm-svn: 273971
2016-06-28 00:18:57 +00:00
Vedant Kumar
078a14ceec [llvm-cov] clang-format a line, NFC
llvm-svn: 273969
2016-06-28 00:18:51 +00:00
Vedant Kumar
3c185dcf6b [llvm-cov] Add a format option for the 'show' sub-command (mostly NFC)
llvm-svn: 273968
2016-06-28 00:15:54 +00:00
Vedant Kumar
0bf7c0b1b7 [llvm-cov] Simplify the way expansion views are rendered (NFC)
If a sub-view has already been rendered, it's helpful to re-render the
expansion site before rendering the next expansion view. Make this fact
explicit in the rendering interface, instead of hiding it behind an
awkward Optional<LineRef> parameter.

llvm-svn: 273789
2016-06-26 02:45:13 +00:00
Vedant Kumar
3d4d8ef75b [llvm-cov] Make an API more consistent, NFC
Make renderExpansionView() look a bit more like renderLine(), and
clarify its doxygen comment.

llvm-svn: 273773
2016-06-25 05:48:59 +00:00
Vedant Kumar
1579f6c57d [llvm-cov] Flesh out some doxygen comments, NFC
llvm-svn: 273772
2016-06-25 05:48:54 +00:00
Vedant Kumar
e117e10095 Try to fix the MSVC build
There's some kind of issue with using "constexpr unsigned" in an
anonymous namespace.

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13395

llvm-svn: 273770
2016-06-25 03:27:29 +00:00
Vedant Kumar
6f6c5e3749 [llvm-cov] Separate presentation logic from formatting logic, NFC
This makes it easier to add renderers for new kinds of output formats.

- Define and document a pure-virtual coverage rendering interface.
- Move the text-based rendering logic into its a new file.
- Re-work the API to better reflect the presentation/formatting split.

llvm-svn: 273767
2016-06-25 02:58:30 +00:00
Vedant Kumar
d73ae86b2a [llvm-cov] Fix two warnings
They were using output streams inconsistently. One also had a grammar
bug.

I noticed these while trying to pare down D18278.

llvm-svn: 273642
2016-06-24 02:33:01 +00:00
Vedant Kumar
66613b7210 [llvm-cov] Use getOptions() instead of Options in SourceCoverageView, NFC
A lot of this code is going to move into the text-based coverage
renderer, and won't be able to use Options directly. Use the getter.

llvm-svn: 273635
2016-06-24 00:41:26 +00:00
Vedant Kumar
9219f54dd4 [llvm-cov] Add SourceNames to SourceCoverageViews, NFC
A SourceName can be a file or a function. It makes sense to attach this
information to a SourceCoverageView, seeing as views (1) already point
to the text corresponding to the relevant source code and (2) are
already used to render that text along with the SourceNames.

This is a nice cleanup which is independent of the upcoming html patch.

While we're at it, document the fields in SourceCoverageView.

llvm-svn: 273634
2016-06-24 00:34:51 +00:00
Vedant Kumar
8b58021d7b [llvm-cov] Rename SourceCoverageView::LineCoverageInfo to LineCoverageStats, NFC
Pull LineCoverageInfo out of SourceCoverageView and rename it so that it
doesn't conflict with another class of the same name in
CoverageSummaryInfo.h.

This cuts down on the amount of code we have to move into a `protected`
section of SourceCoverageView for the upcoming html patch. It also makes
the code a bit clearer: having two LineCoverageInfo's is strange.

llvm-svn: 273633
2016-06-24 00:34:48 +00:00
Vedant Kumar
10905cbc89 NFC, add an "end namespace" comment for consistency
llvm-svn: 273577
2016-06-23 16:27:08 +00:00
Richard Smith
f7f711ffaa Search for llvm-symbolizer binary in the same directory as argv[0], before
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
2016-06-09 00:53:21 +00:00
Benjamin Kramer
d415569b3b Apply most suggestions of clang-tidy's performance-unnecessary-value-param
Avoids unnecessary copies. All changes audited & pass tests with asan.
No functional change intended.

llvm-svn: 272190
2016-06-08 19:09:22 +00:00
Vedant Kumar
ac1be0e432 [llvm-cov] Use string getters (NFC)
llvm-svn: 271537
2016-06-02 17:00:50 +00:00
Vedant Kumar
d34b10ac08 Retry^3 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Changes since the initial commit:
- Fix error message printing in llvm-profdata.
- Check errors in loadTestingFormat() + annotateAllFunctions().
- Defer error handling in InstrProfIterator to InstrProfReader.
- Remove the base ProfError class to work around an MSVC ICE.

Differential Revision: http://reviews.llvm.org/D19901

llvm-svn: 270020
2016-05-19 03:54:45 +00:00
Igor Kudrin
5a4a55829a [Coverage] Ensure that coverage mapping data has an expected alignment in 'covmapping' files.
Coverage mapping data is organized in a sequence of blocks, each of which is expected
to be aligned by 8 bytes. This feature is used when reading those blocks, see
VersionedCovMapFuncRecordReader::readFunctionRecords(). If a misaligned covearge
mapping data has more than one block, it causes llvm-cov to fail.

Differential Revision: http://reviews.llvm.org/D20285

llvm-svn: 269887
2016-05-18 07:43:27 +00:00
Vedant Kumar
e233548c19 Revert "Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""
This reverts commit r269694. MSVC says:

error C2086: 'char llvm::ProfErrorInfoBase<enum llvm::instrprof_error>::ID' : redefinition

llvm-svn: 269700
2016-05-16 21:03:38 +00:00
Vedant Kumar
511487a013 Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Changes since the initial commit:
- Address undefined-var-template warning.
- Fix error message printing in llvm-profdata.
- Check errors in loadTestingFormat() + annotateAllFunctions().
- Defer error handling in InstrProfIterator to InstrProfReader.

Differential Revision: http://reviews.llvm.org/D19901

llvm-svn: 269694
2016-05-16 20:49:39 +00:00
Chandler Carruth
838142a962 Revert "Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""
This reverts commit r269491. It triggers warnings with Clang, breaking
builds for -Werror users including several build bots.

llvm-svn: 269547
2016-05-14 05:26:26 +00:00
Vedant Kumar
b1f881cc44 Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Changes since the initial commit:
- Fix error message printing in llvm-profdata.
- Check errors in loadTestingFormat() + annotateAllFunctions().
- Defer error handling in InstrProfIterator to InstrProfReader.

Differential Revision: http://reviews.llvm.org/D19901

llvm-svn: 269491
2016-05-13 21:50:56 +00:00
Vedant Kumar
f80d958e78 Revert "(HEAD -> master, origin/master, origin/HEAD) [ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
This reverts commit r269462. It fails two llvm-profdata tests.

llvm-svn: 269466
2016-05-13 20:09:39 +00:00
Vedant Kumar
edf8350f15 [ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Differential Revision: http://reviews.llvm.org/D19901

llvm-svn: 269462
2016-05-13 20:01:27 +00:00
Easwaran Raman
bf879068e7 Move coverage related code into a separate library.
Differential Revision: http://reviews.llvm.org/D19333

llvm-svn: 268089
2016-04-29 18:53:05 +00:00
Vedant Kumar
37bef9dfdc [llvm-cov] Don't emit 'nan%' in reports
llvm-svn: 267971
2016-04-29 01:31:49 +00:00
Kevin Enderby
a6534d0295 Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message
Produce the first specific error message for a malformed Mach-O file describing
the problem instead of the generic message for object_error::parse_failed of
"Invalid data was encountered while parsing the file”.  Many more good error
messages will follow after this first one.

This is built on Lang Hames’ great work of adding the ’Error' class for
structured error handling and threading Error through MachOObjectFile
construction.  And making createMachOObjectFile return Expected<...> .

So to to get the error to the llvm-obdump tool, I changed the stack of
these methods to also return Expected<...> :

  object::ObjectFile::createObjectFile()
  object::SymbolicFile::createSymbolicFile()
  object::createBinary()

Then finally in ParseInputMachO() in MachODump.cpp the error can
be reported and the specific error message can be printed in llvm-objdump
and can be seen in the existing test case for the existing malformed binary
but with the updated error message.

Converting these interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. To contain the changes for now use of
errorToErrorCode() and errorOrToExpected() are used where the callers
are yet to be converted.

Also there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values.  So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comment:
“// TODO: Actually report errors helpfully” and a call something like
consumeError(ObjOrErr.takeError()) so the buggy code will not crash
since needed to deal with the Error.

Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along
with this that I will commit right after this.  So expect lld not to built
after this commit and before the next one.

llvm-svn: 265606
2016-04-06 22:14:09 +00:00
Chris Bieneman
1b8d4f74aa Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

Differential Revision: http://reviews.llvm.org/D16471

llvm-svn: 258861
2016-01-26 21:29:08 +00:00
Vedant Kumar
34ef13aeba [llvm-cov] Adjust column widths for function and file reports
Previously, we only expanded function and filename column widths when
rendering file reports. This commit makes the change for function
reports as well.

llvm-svn: 250900
2015-10-21 16:03:32 +00:00
Richard Smith
b279442823 Rename one of our two llvm::GCOVOptions classes to llvm::GCOV::Options. We used
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
2015-10-14 00:04:19 +00:00
Vedant Kumar
3fe9bc0513 [llvm-cov] Disable name and path truncation
Change the output of llvm-cov s.t it does not truncate function names
and file paths when printing coverage reports.

Differential Revision: http://reviews.llvm.org/D12647

rdar://22531141

llvm-svn: 247635
2015-09-14 23:26:36 +00:00
Frederic Riss
0c3b9888f7 [Object] Search for architecures by name in MachOUniversalBinary::getObjectForArch()
The reason we need to search by name rather than by Triple::ArchType
is to handle subarchitecture correclty. There is no different ArchType
for the x86_64h architecture (it identifies itself as x86_64), or for
the various ARM subarches. The only way to get to the subarch slice
in an universal binary is to search by name.

This issue led to hard to debug and transient symbolication failures
in Asan tests (it mostly works, because the files are very similar).

This also affects the Profiling infrastucture as it is the other user
of that API.

Reviewers: samsonov, bogner

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D10604

llvm-svn: 240339
2015-06-22 21:33:24 +00:00
Justin Bogner
5d981f007f llvm-cov: Make llvm-cov --version DTRT
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
2015-06-03 02:48:09 +00:00
Benjamin Kramer
0e31955b32 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

llvm-svn: 238602
2015-05-29 19:43:39 +00:00