summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-03-01 17:02:41 +0000
committerZachary Turner <zturner@google.com>2017-03-01 17:02:41 +0000
commit1fa70d71f26434061ecff71221878ebf07cdb4fb (patch)
tree4b01c5cdab117796ca965e92b5f6625c3abf5709
parent85c3704c0da1bbc88c45ecfb0a5c8bef1df50d25 (diff)
downloadbcm5719-llvm-1fa70d71f26434061ecff71221878ebf07cdb4fb.tar.gz
bcm5719-llvm-1fa70d71f26434061ecff71221878ebf07cdb4fb.zip
[PDB] Remove use of std error codes.
I already created a BinaryStreamError class for this purpose, so update the code to use that on the remaining occurrences of errc values. This should also address the issue which led to r296583. llvm-svn: 296640
-rw-r--r--llvm/unittests/DebugInfo/PDB/BinaryStreamTest.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/unittests/DebugInfo/PDB/BinaryStreamTest.cpp b/llvm/unittests/DebugInfo/PDB/BinaryStreamTest.cpp
index b7308868e05..56552d573ce 100644
--- a/llvm/unittests/DebugInfo/PDB/BinaryStreamTest.cpp
+++ b/llvm/unittests/DebugInfo/PDB/BinaryStreamTest.cpp
@@ -13,7 +13,6 @@
#include "llvm/DebugInfo/MSF/BinaryStreamReader.h"
#include "llvm/DebugInfo/MSF/BinaryStreamRef.h"
#include "llvm/DebugInfo/MSF/BinaryStreamWriter.h"
-#include "llvm/Support/Errc.h"
#include "gtest/gtest.h"
#include <unordered_map>
@@ -56,8 +55,8 @@ public:
Error readBytes(uint32_t Offset, uint32_t Size,
ArrayRef<uint8_t> &Buffer) override {
- if (Offset + Size > Data.size())
- return errorCodeToError(make_error_code(llvm::errc::function_not_supported));
+ if (auto EC = checkOffset(Offset, Size))
+ return EC;
uint32_t S = startIndex(Offset);
auto Ref = Data.drop_front(S);
if (Ref.size() >= Size) {
@@ -75,8 +74,8 @@ public:
Error readLongestContiguousChunk(uint32_t Offset,
ArrayRef<uint8_t> &Buffer) override {
- if (Offset >= Data.size())
- return errorCodeToError(make_error_code(llvm::errc::function_not_supported));
+ if (auto EC = checkOffset(Offset, 1))
+ return EC;
uint32_t S = startIndex(Offset);
Buffer = Data.drop_front(S);
return Error::success();
@@ -85,8 +84,8 @@ public:
uint32_t getLength() override { return Data.size(); }
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> SrcData) override {
- if (Offset + SrcData.size() > Data.size())
- return errorCodeToError(make_error_code(llvm::errc::function_not_supported));
+ if (auto EC = checkOffset(Offset, SrcData.size()))
+ return EC;
if (SrcData.empty())
return Error::success();
OpenPOWER on IntegriCloud