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) {
## .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
## 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