[llvm] r315480 - Convert the last uses of ErrorOr in COFF.h.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 11 10:33:12 PDT 2017
Author: rafael
Date: Wed Oct 11 10:33:11 2017
New Revision: 315480
URL: http://llvm.org/viewvc/llvm-project?rev=315480&view=rev
Log:
Convert the last uses of ErrorOr in COFF.h.
Modified:
llvm/trunk/include/llvm/Object/COFF.h
llvm/trunk/lib/Object/COFFObjectFile.cpp
Modified: llvm/trunk/include/llvm/Object/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=315480&r1=315479&r2=315480&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFF.h (original)
+++ llvm/trunk/include/llvm/Object/COFF.h Wed Oct 11 10:33:11 2017
@@ -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;
Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=315480&r1=315479&r2=315480&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Wed Oct 11 10:33:11 2017
@@ -1648,10 +1648,9 @@ ResourceSectionRef::getDirStringAtOffset
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(uin
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);
}
More information about the llvm-commits
mailing list