llvm-project/lld/lib/Driver
Rui Ueyama 64cfffd333 ELF: Rename error -> fatal and redefine error as a non-noreturn function.
In many situations, we don't want to exit at the first error even in the
process model. For example, it is better to report all undefined symbols
rather than reporting the first one that the linker picked up randomly.

In order to handle such errors, we don't need to wrap everything with
ErrorOr (thanks for David Blaikie for pointing this out!) Instead, we
can set a flag to record the fact that we found an error and keep it
going until it reaches a reasonable checkpoint.

This idea should be applicable to other places. For example, we can
ignore broken relocations and check for errors after visiting all relocs.

In this patch, I rename error to fatal, and introduce another version of
error which doesn't call exit. That function instead sets HasError to true.
Once HasError becomes true, it stays true, so that we know that there
was an error if it is true.

I think introducing a non-noreturn error reporting function is by itself
a good idea, and it looks to me that this also provides a gradual path
towards lld-as-a-library (or at least embed-lld-to-your-program) without
sacrificing code readability with lots of ErrorOr's.

http://reviews.llvm.org/D16641

llvm-svn: 259069
2016-01-28 18:40:06 +00:00
..
CMakeLists.txt [old ELF] Remove AMDGPU target 2016-01-11 21:40:40 +00:00
CoreDriver.cpp Move parsing of LLVM options to parse() method. 2015-12-16 20:53:27 +00:00
CoreOptions.td This is my Driver refactoring patch. 2013-04-04 18:59:24 +00:00
DarwinLdDriver.cpp Add support for export_dynamic cmdline option and behaviour. 2016-01-22 21:13:24 +00:00
DarwinLdOptions.td Add support for export_dynamic cmdline option and behaviour. 2016-01-22 21:13:24 +00:00
Driver.cpp Move parsing of LLVM options to parse() method. 2015-12-16 20:53:27 +00:00
GnuLdDriver.cpp [old ELF] Remove AMDGPU target 2016-01-11 21:40:40 +00:00
GnuLdOptions.td [Driver] Ignore -G option in both new and old ELF linker 2015-10-28 14:50:58 +00:00
TODO.rst [GNU] Remove -x/-X from the list of options to be implemented. 2015-04-29 20:35:58 +00:00
UniversalDriver.cpp ELF: Rename error -> fatal and redefine error as a non-noreturn function. 2016-01-28 18:40:06 +00:00
UniversalDriverOptions.td Add support to print version. 2014-10-08 03:47:51 +00:00