1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/lib/DebugInfo
Alexey Lapshin 35d0c4caae [Debuginfo][NFC] Unify error reporting routines inside DebugInfoDWARF.
Summary:
Error reporting in DebugInfoDWARF library currently done in three ways :

1. Direct calls to WithColor::error()/WithColor::warning()
2. ErrorPolicy defaultErrorHandler(Error E);
3. void dumpWarning(Error Warning);

additionally, other locations could have more variations:

lld/ELF/SyntheticSection.cpp
    if (Error e = cu->tryExtractDIEsIfNeeded(false)) {
      error(toString(sec) + ": " + toString(std::move(e)));

DebugInfo/DWARF/DWARFUnit.cpp
  if (Error e = tryExtractDIEsIfNeeded(CUDieOnly))
    WithColor::error() << toString(std::move(e));

Thus error reporting could look inconsistent. To have a consistent error
messages it is necessary to have a possibility to redefine error
reporting functions. This patch creates two handlers and allows to
redefine them. It also patches all places inside DebugInfoDWARF
to use these handlers.

The intention is always to use following handlers for error reporting
purposes inside DebugInfoDWARF:

DebugInfo/DWARF/DWARFContext.h

std::function<void(Error E)> RecoverableErrorHandler = WithColor::defaultErrorHandler;
std::function<void(Error E)> WarningHandler = WithColor::defaultWarningHandler;

This is last patch from series of patches: D74481, D74635, D75118.

Reviewers: jhenderson, dblaikie, probinson, aprantl, JDevlieghere

Reviewed By: jhenderson

Subscribers: grimar, hiraditya, llvm-commits

Tags: #llvm, #debug-info

Differential Revision: https://reviews.llvm.org/D74308
2020-02-27 18:32:40 +03:00
..
CodeView [MCStreamer] De-capitalize EmitValue EmitIntValue{,InHex} 2020-02-14 23:08:40 -08:00
DWARF [Debuginfo][NFC] Unify error reporting routines inside DebugInfoDWARF. 2020-02-27 18:32:40 +03:00
GSYM Add missing dependency to fix shared library build. 2020-02-26 01:59:53 -05:00
MSF Revert "Remove redundant "std::move"s in return statements" 2020-02-10 07:07:40 -08:00
PDB Add missing newlines at EOF; NFC 2020-02-12 15:57:25 +00:00
Symbolize [Debuginfo][NFC] Unify error reporting routines inside DebugInfoDWARF. 2020-02-27 18:32:40 +03:00
CMakeLists.txt
LLVMBuild.txt