[ELF] Update lld now that ELF.h in LLVM has been converted to Expected.
authorDavide Italiano <davide@freebsd.org>
Wed, 16 Nov 2016 05:11:30 +0000 (05:11 +0000)
committerDavide Italiano <davide@freebsd.org>
Wed, 16 Nov 2016 05:11:30 +0000 (05:11 +0000)
llvm-svn: 287082

lld/ELF/Error.h
lld/test/ELF/invalid/mips-invalid-options-descriptor.s
lld/test/ELF/invalid/sht-group.s

index 8b6c465..186f53c 100644 (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) {
index 83cf619..b47bd90 100644 (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
index 5773017..f28035f 100644 (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