Commit Graph

7110 Commits

Author SHA1 Message Date
Zachary Turner f6b9382467 [pdb] Add a pdb2yaml option to not dump file headers.
This will be useful once we start adding the ability to dump type
records and symbol records, since it will allow us to generate
mergeable information instead of information that specifies an
entire file.

llvm-svn: 275109
2016-07-11 21:45:09 +00:00
Nirav Dave 53a72f4d3c Provide support for preserving assembly comments
Preserve assembly comments from input in output assembly and flags to
toggle property. This is on by default for inline assembly and off in
llvm-mc.

Parsed comments are emitted immediately before an EOL which generally
places them on the expected line.

Reviewers: rtrieu, dwmw2, rnk, majnemer

Subscribers: llvm-commits

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

llvm-svn: 275058
2016-07-11 12:42:14 +00:00
Benjamin Kramer da5b4cc339 [codeview] Drop unused private inheritance.
There is no polymorphism here, and StreamRef already contains a
StreamInterface pointer. Dropping the base class makes StreamRef more
transparent to the compiler, for example it can find unused variables.

llvm-svn: 275013
2016-07-10 10:17:36 +00:00
Michael Gottesman daaf9f1379 [cmake] Change lli-child-target to use add_llvm_utility instead of add_llvm_executable.
We are currently using add_llvm_utility for executable targets that:

1. Are built by default.
2. Used for testing.
3. Are not installed by default.

Originally, lli-child-target used add_llvm_tool instead of add_llvm_executable
directly. This was changed so that lli-child-target would not be installed. This
was good since this is only used for testing and should never be installed for
users. This also had the unfortunate side effect that one can never turn off the
building of lli-child-target by default, a regression for projects that by
default do not want to compile any LLVM tools beyond tablegen/llvm-config.

This patch changes lli-child-target to use add_llvm_utility. This makes sense
since:

1. lli-child-target matches the semantics of executables created with
add_llvm_utility.
2. We fix the regression since now one can use the flag LLVM_BUILD_UTILS to
eliminate default compilation.

llvm-svn: 275008
2016-07-10 02:43:50 +00:00
Wei Mi 90d195a5fd [PM] Port UnreachableBlockElim to the new Pass Manager
Differential Revision: http://reviews.llvm.org/D22124

llvm-svn: 274824
2016-07-08 03:32:49 +00:00
Vedant Kumar af0dd931e6 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 4c01092a25 [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
Zachary Turner 8848a7a6b2 [pdb] Round trip the PDB stream between YAML and binary PDB.
This gets writing of the PDB stream working.

llvm-svn: 274647
2016-07-06 18:05:57 +00:00
Zachary Turner ab58ae8730 [pdb] Re-add code to write PDB files.
Somehow all the functionality to write PDB files got removed,
probably accidentally when uploading the patch perhaps the wrong
one got uploaded.  This re-adds all the code, as well as the
corresponding test.

llvm-svn: 274248
2016-06-30 17:43:00 +00:00
Zachary Turner a30bd1a1bc Update llvm-pdbdump to use subcommands.
llvm-svn: 274247
2016-06-30 17:42:48 +00:00
Peter Collingbourne 8ec68fad33 Object: Replace NewArchiveIterator with a simpler NewArchiveMember class. NFCI.
The NewArchiveIterator class has a problem: it requires too much context. Any
memory buffers added to the archive must be stored within an Archive::Member,
which must have an associated Archive. This makes it harder than necessary
to create new archive members (or new archives entirely) from scratch using
memory buffers.

This patch replaces NewArchiveIterator with a NewArchiveMember class that
stores just the memory buffer and the information that goes into the archive
member header.

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

llvm-svn: 274183
2016-06-29 22:27:42 +00:00
Vedant Kumar d6d192cd12 [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
Kevin Enderby c60a321c6b Change Archive::create() from ErrorOr<...> to Expected<...> and update
its clients.

This commit will break the next lld builds.  I’ll be committing the matching
change for lld next.

llvm-svn: 274160
2016-06-29 20:35:44 +00:00
Rafael Espindola 2211f015cc Don't verify inputs to the Linker if ODR merging.
This fixes pr28072.

The point, as Duncan pointed out, is that the file is already
partially linked by just reading it.

Long term I think the solution is to make metadata owned by the module
and then the linker will lazily read it and be in charge of all the
linking. Running a verifier in each input will defeat the lazy
loading, but will be legal.

Right now we are at the unfortunate position that to support odr
merging we cannot verify the inputs, which mildly annoying (see test
update).

llvm-svn: 274148
2016-06-29 18:31:48 +00:00
Vedant Kumar 699693b923 Use LLVM_ATTRIBUTE_UNUSED instead of void casts; NFC
llvm-svn: 274139
2016-06-29 16:56:46 +00:00
Vedant Kumar 4a54abeacd [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
Philip Reames d2232a539d [bugpoint] Delete a stale comment.
llvm-svn: 274093
2016-06-29 03:02:01 +00:00
Philip Reames e5b5602008 [bugpoint] Unwrap one level of wrapper functions [NFC]
llvm-svn: 274092
2016-06-29 03:01:13 +00:00
Philip Reames 1c232f9b66 [bugpoint] Extract helper functions for readability [NFCI]
And remove the use of a label(!) in the process.  

llvm-svn: 274087
2016-06-29 00:43:18 +00:00
Vedant Kumar 8d74cb27e8 [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
Philip Reames 78153a6d6e [bugpoint] Simplify code by moving exception to only caller
llvm-svn: 274083
2016-06-29 00:26:21 +00:00
Philip Reames 29e641cd26 [bugpoint] Treat token type the same as ehpad w.r.t deletion
llvm-svn: 274082
2016-06-29 00:15:35 +00:00
Philip Reames ac285cc9f6 [bugpoint] Disabling one transform shouldn't prevent reporting the progress of the former
llvm-svn: 274081
2016-06-29 00:10:39 +00:00
Kevin Enderby 42398051d8 Finish cleaning up most of the error handling in libObject’s MachOUniversalBinary
and its clients to use the new llvm::Error model for error handling.

Changed getAsArchive() from ErrorOr<...> to Expected<...> so now all
interfaces there use the new llvm::Error model for return values.

In the two places it had if (!Parent) this is actually a program error so changed
from returning errorCodeToError(object_error::parse_failed) to calling
report_fatal_error() with a message.

In getObjectForArch() added error messages to its two llvm::Error return values
instead of returning errorCodeToError(object_error::arch_not_found) with no
error message.

For the llvm-obdump, llvm-nm and llvm-size clients since the only binary files in
Mach-O Universal Binaries that are supported are Mach-O files or archives with
Mach-O objects, updated their logic to generate an error when a slice contains
something like an ELF binary instead of ignoring it. And added a test case for
that.

The last error stuff to be cleaned up for libObject’s MachOUniversalBinary is
the use of errorOrToExpected(Archive::create(ObjBuffer)) which needs
Archive::create() to be changed from ErrorOr<...> to Expected<...> first,
which I’ll work on next. 

llvm-svn: 274079
2016-06-28 23:16:13 +00:00
Simon Pilgrim 0fecee9cd8 Fix "not all control paths return a value" warning on MSVC
llvm-svn: 274065
2016-06-28 21:02:41 +00:00
Vedant Kumar 9cbad2c2b8 [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 64d8a029e9 [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 cef440f7a7 [llvm-cov] Avoid copying file paths multiple times (NFC)
llvm-svn: 274027
2016-06-28 16:12:18 +00:00
Vedant Kumar ebe8401638 [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 de717e655b [llvm-cov] Move a check into a helper method (NFC)
llvm-svn: 274025
2016-06-28 16:12:12 +00:00
Simon Pilgrim d95a172389 Fix "not all control paths return a value" warning on MSVC
llvm-svn: 274011
2016-06-28 12:55:35 +00:00
Vedant Kumar 72e0fe9c12 [llvm-cov] Simplify; NFC
llvm-svn: 273988
2016-06-28 03:37:56 +00:00
Vedant Kumar 7937ef3796 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 a48d9fe86a 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 02507c435c [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 727549ee74 [llvm-cov] clang-format a line, NFC
llvm-svn: 273969
2016-06-28 00:18:51 +00:00
Vedant Kumar 635c83c1b4 [llvm-cov] Add a format option for the 'show' sub-command (mostly NFC)
llvm-svn: 273968
2016-06-28 00:15:54 +00:00
Kevin Enderby 1051909df1 Change all but the last ErrorOr<...> use for MachOUniversalBinary to Expected<...> to
allow a good error message to be produced.

I added the one test case that the object file tools could produce an error
message.  The other two errors can’t be triggered if the input file is passed
through sys::fs::identify_magic().  But the malformedError("bad magic number")
does get triggered by the logic in llvm-dsymutil when dealing with a normal
Mach-O file.  The other "File too small ..." error would take a logic error
currently to produce and is not tested for.

llvm-svn: 273946
2016-06-27 21:39:39 +00:00
Davide Italiano 9ffb554e5b [llvm-ar] Ignore -plugin option.
binutils ar uses -plugin to specify the LTO plugin, but LLVM doesn't
need this as it doesn't use a plugin for LTO. Accepting (and ignoring)
the option allows interoperability with existing build systems and
make downstream consumers life much easier.

No objections from Rafael on this change.

llvm-svn: 273938
2016-06-27 20:38:39 +00:00
Chris Bieneman 8ff0c11357 [yaml2obj] Remove --format option in favor of YAML tags
Summary:
Our YAML library's handling of tags isn't perfect, but it is good enough to get rid of the need for the --format argument to yaml2obj. This patch does exactly that.

Instead of requiring --format, it infers the format based on the tags found in the object file. The supported tags are:

!ELF
!COFF
!mach-o
!fat-mach-o

I have a corresponding patch that is quite large that fixes up all the in-tree test cases.

Reviewers: rafael, Bigcheese, compnerd, silvas

Subscribers: compnerd, llvm-commits

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

llvm-svn: 273915
2016-06-27 19:53:53 +00:00
David Majnemer ad7b7e73a5 [Object, COFF] An import data directory might not consist soley of imports
The last import is the penultimate entry, the last entry is nulled out.
Data beyond the null entry should not be considered to hold import
entries.

This fixes PR28302.

N.B.  I am working on a reduced testcase, the one in PR28302 is too
large.

llvm-svn: 273790
2016-06-26 04:36:32 +00:00
Vedant Kumar 861a19c294 [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 8b12ecb721 [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 ee5a5e9bce [llvm-cov] Flesh out some doxygen comments, NFC
llvm-svn: 273772
2016-06-25 05:48:54 +00:00
Vedant Kumar 4f4e8d813d 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 f9151b9372 [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
Chris Bieneman 93e7119380 [obj2yaml] [yaml2obj] Support for MachO Universal binaries
This patch adds round-trip support for MachO Universal binaries to obj2yaml and yaml2obj. Universal binaries have a header and list of architecture structures, followed by a the individual object files at specified offsets.

llvm-svn: 273719
2016-06-24 20:42:28 +00:00
Michael Kuperstein 82d5da5aac [PM] Port PreISelIntrinsicLowering to the new PM
llvm-svn: 273713
2016-06-24 20:13:42 +00:00
Kevin Enderby 931cb65df2 Thread Expected<...> up from libObject’s getSymbolAddress() for symbols to allow
a good error message to be produced.

This is nearly the last libObject interface that used ErrorOr and the last one
that appears in llvm/include/llvm/Object/MachO.h .  For Mach-O objects this is
just a clean up because it’s version of getSymbolAddress() can’t return an
error.

I will leave it to the experts on COFF and ELF to actually add meaning full
error messages in their tests if they wish.  And also leave it to these experts
to change the last two ErrorOr interfaces in llvm/include/llvm/Object/ObjectFile.h
for createCOFFObjectFile() and createELFObjectFile() if they wish.

Since there are no test cases for COFF and ELF error cases with respect to
getSymbolAddress() in the test suite this is no functional change (NFC).

llvm-svn: 273701
2016-06-24 18:24:42 +00:00
Vedant Kumar 2c96e88ed4 [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