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

20 Commits

Author SHA1 Message Date
Rui Ueyama
e59fc0b2e5 Remove object_error::success and use std::error_code() instead
make_error_code(object_error) is slow because object::object_category()
uses a ManagedStatic variable. But the real problem is that the function is
called too frequently. This patch uses std::error_code() instead of
object_error::success. In most cases, we return "success", so this patch
reduces number of function calls to that function.

http://reviews.llvm.org/D10333

llvm-svn: 239409
2015-06-09 15:20:42 +00:00
Alexey Samsonov
09879a84df [Object, MachO] Don't crash on invalid MachO segment load commands.
Summary:
Properly report the error in segment load commands from MachOObjectFile
constructor instead of crashing the program.

Adjust the test case accordingly.

Test Plan: regression test suite

Reviewers: rafael, filcab

Subscribers: llvm-commits
llvm-svn: 239081
2015-06-04 20:08:52 +00:00
Alexey Samsonov
c5843d04e0 [Object, MachO] Don't crash on invalid MachO load commands.
Summary:
Currently all load commands are parsed in MachOObjectFile constructor.
If the next load command cannot be parsed, or if command size is too
small, properly report it through the error code and fail to construct
the object, instead of crashing the program.

Test Plan: regression test suite

Reviewers: rafael, filcab

Subscribers: llvm-commits
llvm-svn: 239080
2015-06-04 19:57:46 +00:00
Chris Bieneman
1298997707 Converting object's error_category to a ManagedStatic to avoid static constructors and destructors.
llvm-svn: 218160
2014-09-19 22:09:18 +00:00
Peter Collingbourne
3d7ffbad08 LTO: introduce object file-based on-disk module format.
This format is simply a regular object file with the bitcode stored in a
section named ".llvmbc", plus any number of other (non-allocated) sections.

One immediate use case for this is to accommodate compilation processes
which expect the object file to contain metadata in non-allocated sections,
such as the ".go_export" section used by some Go compilers [1], although I
imagine that in the future we could consider compiling parts of the module
(such as large non-inlinable functions) directly into the object file to
improve LTO efficiency.

[1] http://golang.org/doc/install/gccgo#Imports

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

llvm-svn: 218078
2014-09-18 21:28:49 +00:00
Abramo Bagnara
7d64c5c4b9 Added forgotten noexcept.
llvm-svn: 215886
2014-08-18 07:48:18 +00:00
Rafael Espindola
526c55c690 Remove unused and odd code.
This code was never being used and any use of it would look fairly strange.
For example, it would try to map a object_error::parse_failed to
std::errc::invalid_argument.

llvm-svn: 210912
2014-06-13 15:36:17 +00:00
Rafael Espindola
b0ac81f225 Don't import error_category into the llvm namespace.
llvm-svn: 210733
2014-06-12 01:45:43 +00:00
Rafael Espindola
c7f351302b Don't import error_condition into the llvm namespace.
llvm-svn: 210731
2014-06-12 01:29:42 +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
Rafael Espindola
80bf4067ff Mark a few functions noexcept.
This reduces the difference between std::error_code and llvm::error_code.

llvm-svn: 210591
2014-06-10 21:26:47 +00:00
Rafael Espindola
99907878d9 Use an enum class.
llvm-svn: 210078
2014-06-03 05:26:12 +00:00
Rafael Espindola
a46bdb6d4d There is no std::errc::success, remove the llvm one.
llvm-svn: 209960
2014-05-31 03:21:04 +00:00
Justin Bogner
b27be63011 Support: Make error_category's constructor public
Since our error_category is based on the std one, we should have the
same visibility for the constructor.  This also allows us to avoid
using the _do_message implementation detail in our own categories.

llvm-svn: 203998
2014-03-15 04:05:59 +00:00
Alexey Samsonov
50c414e3d0 Basic support for parsing Mach-O universal binaries in LLVMObject library
llvm-svn: 184191
2013-06-18 15:03:28 +00:00
Rafael Espindola
0d881ffff7 Don't convert object_error's enum to and from int.
This allows the compiler to see the enum and warn about it. While in here,
fix a switch to not use a default and fix style violations.

llvm-svn: 184186
2013-06-18 13:30:31 +00:00
Michael J. Spencer
83e956656a Object: Add proper error handling.
llvm-svn: 133872
2011-06-25 17:55:23 +00:00
Michael J. Spencer
435e1ee994 Add Object/Error.
llvm-svn: 133868
2011-06-25 17:42:56 +00:00
Benjamin Kramer
8bd126a5c6 Revert r132910 and r132909 on behalf of Michael. They didn't build with clang.
llvm-svn: 132914
2011-06-13 12:56:51 +00:00
Michael J. Spencer
d6178b9f59 Add Object/Error.
llvm-svn: 132909
2011-06-13 11:11:59 +00:00