[COFF] Migrate COFFObjectFile to Expected<T>
authorReid Kleckner <rnk@google.com>
Fri, 8 May 2020 17:41:05 +0000 (10:41 -0700)
committerReid Kleckner <rnk@google.com>
Fri, 8 May 2020 21:01:39 +0000 (14:01 -0700)
commit77ecf90c52641aadedf6bad7c8bea5b217b49729
tree66c038f13524ab7b41762cb8f2871e0fe4f278e1
parentebb69b8bafad6948ee6a14b4087fb7b440c73d0d
[COFF] Migrate COFFObjectFile to Expected<T>

I noticed that std::error_code() does one-time initialization. Avoid
that overhead with Expected<T> and llvm::Error. Also, it is consistent
with the virtual interface and ELF, and generally cleaner.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D79643
lld/COFF/Chunks.cpp
lld/COFF/InputFiles.cpp
lld/COFF/Symbols.cpp
llvm/include/llvm/Object/COFF.h
llvm/lib/Object/COFFObjectFile.cpp
llvm/tools/llvm-objcopy/COFF/Reader.cpp
llvm/tools/llvm-objdump/COFFDump.cpp
llvm/tools/llvm-readobj/COFFDumper.cpp
llvm/tools/obj2yaml/coff2yaml.cpp