1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/tools/llvm-objcopy/COFF
Jordan Rupprecht 465c087d4f [llvm-objcopy] Return Error from Buffer::allocate(), [ELF]Writer::finalize(), and [ELF]Writer::commit()
Summary:
This patch changes a few methods to return Error instead of manually calling error/reportError to abort. This will make it easier to extract into a library.

Note that error() takes just a string (this patch also adds an overload that takes an Error), while reportError() takes string + [error/code]. To help unify things, use FileError to associate a given filename with an error. Note that this takes some special care (for now), e.g. calling reportError(FileName, <something that could be FileError>) will duplicate the filename. The goal is to eventually remove reportError() and have every error associated with a file to be a FileError, and just one error handling block at the tool level.

This change was suggested in D56806. I took it a little further than suggested, but completely fixing llvm-objcopy will take a couple more patches. If this approach looks good, I'll commit this and apply similar patche(s) for the rest.

This change is NFC in terms of non-error related code, although the error message changes in one context.

Reviewers: alexshap, jhenderson, jakehehrlich, mstorsjo, espindola

Reviewed By: alexshap, jhenderson

Subscribers: llvm-commits, emaste, arichardson

Differential Revision: https://reviews.llvm.org/D56930

llvm-svn: 351896
2019-01-22 23:49:16 +00:00
..
COFFObjcopy.cpp Revert "[llvm-objcopy] [COFF] Implement --add-gnu-debuglink" 2019-01-22 12:35:34 +00:00
COFFObjcopy.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Object.cpp Revert "[llvm-objcopy] [COFF] Implement --add-gnu-debuglink" 2019-01-22 12:35:34 +00:00
Object.h Revert "[llvm-objcopy] [COFF] Implement --add-gnu-debuglink" 2019-01-22 12:35:34 +00:00
Reader.cpp Revert "[llvm-objcopy] [COFF] Implement --add-gnu-debuglink" 2019-01-22 12:35:34 +00:00
Reader.h [llvm-objcopy] [COFF] Update symbol indices in weak externals 2019-01-22 10:58:09 +00:00
Writer.cpp [llvm-objcopy] Return Error from Buffer::allocate(), [ELF]Writer::finalize(), and [ELF]Writer::commit() 2019-01-22 23:49:16 +00:00
Writer.h [llvm-objcopy] [COFF] Update symbol indices in weak externals 2019-01-22 10:58:09 +00:00