diff options
author | Zachary Turner <zturner@google.com> | 2016-05-06 20:51:57 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-05-06 20:51:57 +0000 |
commit | 819e77d196f208cc8ef15b4186e07ecb14a115c8 (patch) | |
tree | 409e2ff42a99563c75759c4c22116c35eb60569c /llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp | |
parent | 091fcfa3a7632b6bbfbefdac84e0425d827d288c (diff) | |
download | bcm5719-llvm-819e77d196f208cc8ef15b4186e07ecb14a115c8.tar.gz bcm5719-llvm-819e77d196f208cc8ef15b4186e07ecb14a115c8.zip |
Port DebugInfoPDB over to using llvm::Error.
Differential Revision: http://reviews.llvm.org/D19940
Reviewed By: rnk
llvm-svn: 268791
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp index 81e75d7d759..af047f73abd 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp @@ -9,6 +9,7 @@ #include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h" #include "llvm/DebugInfo/PDB/Raw/PDBFile.h" +#include "llvm/DebugInfo/PDB/Raw/RawError.h" using namespace llvm; using namespace llvm::pdb; @@ -18,17 +19,16 @@ MappedBlockStream::MappedBlockStream(uint32_t StreamIdx, const PDBFile &File) : BlockList = Pdb.getStreamBlockList(StreamIdx); } -std::error_code -MappedBlockStream::readBytes(uint32_t Offset, - MutableArrayRef<uint8_t> Buffer) const { +Error MappedBlockStream::readBytes(uint32_t Offset, + MutableArrayRef<uint8_t> Buffer) const { uint32_t BlockNum = Offset / Pdb.getBlockSize(); uint32_t OffsetInBlock = Offset % Pdb.getBlockSize(); // Make sure we aren't trying to read beyond the end of the stream. if (Buffer.size() > StreamLength) - return std::make_error_code(std::errc::bad_address); + return make_error<RawError>(raw_error_code::insufficient_buffer); if (Offset > StreamLength - Buffer.size()) - return std::make_error_code(std::errc::bad_address); + return make_error<RawError>(raw_error_code::insufficient_buffer); uint32_t BytesLeft = Buffer.size(); uint32_t BytesWritten = 0; @@ -49,11 +49,10 @@ MappedBlockStream::readBytes(uint32_t Offset, OffsetInBlock = 0; } - return std::error_code(); + return Error::success(); } -std::error_code MappedBlockStream::getArrayRef(uint32_t Offset, - ArrayRef<uint8_t> &Buffer, - uint32_t Length) const { - return std::make_error_code(std::errc::not_supported); +Error MappedBlockStream::getArrayRef(uint32_t Offset, ArrayRef<uint8_t> &Buffer, + uint32_t Length) const { + return make_error<RawError>(raw_error_code::feature_unsupported); } |