[ELF] Update lld now that ELF.h in LLVM has been converted to Expected.

llvm-svn: 287082
This commit is contained in:
Davide Italiano 2016-11-16 05:11:30 +00:00
parent 6cf09265f9
commit 197f07e650
3 changed files with 13 additions and 5 deletions

View File

@ -51,10 +51,18 @@ template <class T> T check(ErrorOr<T> E) {
return std::move(*E);
}
static inline void check(Error E) {
handleAllErrors(std::move(E), [&](llvm::ErrorInfoBase &EIB) -> Error {
fatal(EIB.message());
return Error::success();
});
}
template <class T> T check(Expected<T> E) {
if (!E)
fatal(errorToErrorCode(E.takeError()).message());
return std::move(*E);
if (E)
return std::move(*E);
check(E.takeError());
return T();
}
template <class T> T check(ErrorOr<T> E, const Twine &Prefix) {

View File

@ -2,4 +2,4 @@
## .MIPS.options with size of zero.
# RUN: not ld.lld %p/Inputs/mips-invalid-options-descriptor.elf -o %t2 2>&1 | \
# RUN: FileCheck %s
# CHECK: error: Invalid data was encountered while parsing the file
# CHECK: error: invalid section offset

View File

@ -1,3 +1,3 @@
## sht-group.elf contains SHT_GROUP section with invalid sh_info.
# RUN: not ld.lld %p/Inputs/sht-group.elf -o %t2 2>&1 | FileCheck %s
# CHECK: Invalid symbol index
# CHECK: invalid symbol index