summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Raw/StreamReader.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-05-25 20:37:03 +0000
committerZachary Turner <zturner@google.com>2016-05-25 20:37:03 +0000
commitd5d37dcf8329b7c5774aadc60c4474c8e4a4e55f (patch)
treed6b8dde6b19a10110b013544b3288848120add80 /llvm/lib/DebugInfo/PDB/Raw/StreamReader.cpp
parent1fe3f1ca50bfc7b1dcc356ee9785bfe3757a8aec (diff)
downloadbcm5719-llvm-d5d37dcf8329b7c5774aadc60c4474c8e4a4e55f.tar.gz
bcm5719-llvm-d5d37dcf8329b7c5774aadc60c4474c8e4a4e55f.zip
[codeview] Move StreamInterface and StreamReader to libcodeview.
We have need to reuse this functionality, including making additional generic stream types that are smarter about how and when they copy memory versus referencing the original memory. So all of these structures belong in the common library rather than being pdb specific. llvm-svn: 270751
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/StreamReader.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/StreamReader.cpp50
1 files changed, 0 insertions, 50 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/StreamReader.cpp b/llvm/lib/DebugInfo/PDB/Raw/StreamReader.cpp
deleted file mode 100644
index ed9c9d400af..00000000000
--- a/llvm/lib/DebugInfo/PDB/Raw/StreamReader.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-//===- StreamReader.cpp - Reads bytes and objects from a stream -----------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/DebugInfo/PDB/Raw/StreamReader.h"
-#include "llvm/DebugInfo/PDB/Raw/RawError.h"
-
-using namespace llvm;
-using namespace llvm::pdb;
-
-StreamReader::StreamReader(const StreamInterface &S) : Stream(S), Offset(0) {}
-
-Error StreamReader::readBytes(MutableArrayRef<uint8_t> Buffer) {
- if (auto EC = Stream.readBytes(Offset, Buffer))
- return EC;
- Offset += Buffer.size();
- return Error::success();
-}
-
-Error StreamReader::readInteger(uint32_t &Dest) {
- support::ulittle32_t P;
- if (auto EC = readObject(&P))
- return EC;
- Dest = P;
- return Error::success();
-}
-
-Error StreamReader::readZeroString(std::string &Dest) {
- Dest.clear();
- char C;
- do {
- if (auto EC = readObject(&C))
- return EC;
- if (C != '\0')
- Dest.push_back(C);
- } while (C != '\0');
- return Error::success();
-}
-
-Error StreamReader::getArrayRef(ArrayRef<uint8_t> &Array, uint32_t Length) {
- if (auto EC = Stream.getArrayRef(Offset, Array, Length))
- return EC;
- Offset += Length;
- return Error::success();
-}
OpenPOWER on IntegriCloud