[PATCH] D34328: [ELF] - Add ability for DWARFContextInMemory to exit early when any error happen.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 18 08:54:29 PDT 2017


grimar created this revision.

That is change that I am trying to suggest for use in LLD.

It allows to exit parsing of object early on any error that happens. That
can allow us to fail the link on any first error, because there is no reason to continue
parcing of object in that case.

Detailed description of why that can be useful for LLD on review page (https://reviews.llvm.org/D34327),
description about details of implementation of this patch is below.

I tried several ways to implement it.

1. Implementing something like next interface:

  static Expected<std::unique_ptr<DWARFContextInMemory>>
  create(const object::ObjectFile &Obj, const LoadedObjectInfo *L = nullptr);

And found that there are too much users of DWARFContextInMemory.
And some of them do not really need exit on first error, changing interface
in that way involves many changes for no visible reason.

2. I considered extending LoadedObjectInfo interface with something like

  bool allowErrors().

That needs LoadedObjectInfo object to be used. We do not use it in
LLD right now and that looks too much to do for such purpose.

3. This way, Adding single additional flag IMO allows to do both little cleanup and still

keep things simple. This can be reused by any client easily.


https://reviews.llvm.org/D34328

Files:
  include/llvm/DebugInfo/DWARF/DWARFContext.h
  lib/DebugInfo/DWARF/DWARFContext.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34328.102970.patch
Type: text/x-patch
Size: 3745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170618/6e49bb01/attachment.bin>


More information about the llvm-commits mailing list