OSDN Git Service

Convert the last uses of ErrorOr in COFF.h.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 11 Oct 2017 17:33:11 +0000 (17:33 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 11 Oct 2017 17:33:11 +0000 (17:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315480 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/COFF.h
lib/Object/COFFObjectFile.cpp

index 8286124..c5b500d 100644 (file)
@@ -25,7 +25,6 @@
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ErrorOr.h"
 #include <cassert>
 #include <cstddef>
 #include <cstdint>
@@ -1164,10 +1163,11 @@ public:
   ResourceSectionRef() = default;
   explicit ResourceSectionRef(StringRef Ref) : BBS(Ref, support::little) {}
 
-  ErrorOr<ArrayRef<UTF16>> getEntryNameString(const coff_resource_dir_entry &Entry);
-  ErrorOr<const coff_resource_dir_table &>
+  Expected<ArrayRef<UTF16>>
+  getEntryNameString(const coff_resource_dir_entry &Entry);
+  Expected<const coff_resource_dir_table &>
   getEntrySubDir(const coff_resource_dir_entry &Entry);
-  ErrorOr<const coff_resource_dir_table &> getBaseTable();
+  Expected<const coff_resource_dir_table &> getBaseTable();
 
 private:
   BinaryByteStream BBS;
index 1257d1c..06ac6df 100644 (file)
@@ -1648,10 +1648,9 @@ ResourceSectionRef::getDirStringAtOffset(uint32_t Offset) {
   return RawDirString;
 }
 
-ErrorOr<ArrayRef<UTF16>>
+Expected<ArrayRef<UTF16>>
 ResourceSectionRef::getEntryNameString(const coff_resource_dir_entry &Entry) {
-  return expectedToErrorOr(
-      getDirStringAtOffset(Entry.Identifier.getNameOffset()));
+  return getDirStringAtOffset(Entry.Identifier.getNameOffset());
 }
 
 Expected<const coff_resource_dir_table &>
@@ -1665,11 +1664,11 @@ ResourceSectionRef::getTableAtOffset(uint32_t Offset) {
   return *Table;
 }
 
-ErrorOr<const coff_resource_dir_table &>
+Expected<const coff_resource_dir_table &>
 ResourceSectionRef::getEntrySubDir(const coff_resource_dir_entry &Entry) {
-  return expectedToErrorOr(getTableAtOffset(Entry.Offset.value()));
+  return getTableAtOffset(Entry.Offset.value());
 }
 
-ErrorOr<const coff_resource_dir_table &> ResourceSectionRef::getBaseTable() {
-  return expectedToErrorOr(getTableAtOffset(0));
+Expected<const coff_resource_dir_table &> ResourceSectionRef::getBaseTable() {
+  return getTableAtOffset(0);
 }