#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>
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;
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 &>
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);
}