aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-06-10 05:09:12 +0000
committerZachary Turner <zturner@google.com>2016-06-10 05:09:12 +0000
commit5acb4ac6d7989e5f59dd6bc035cc1110b2c830dd (patch)
tree463ec56d93f2cc3a2ea42a1d798809a5290020ab /llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
parent6a77a1c01f5f3f76546afd97c9aa1d2747bb7b6e (diff)
downloadllvm-5acb4ac6d7989e5f59dd6bc035cc1110b2c830dd.zip
llvm-5acb4ac6d7989e5f59dd6bc035cc1110b2c830dd.tar.gz
llvm-5acb4ac6d7989e5f59dd6bc035cc1110b2c830dd.tar.bz2
Add support for writing through StreamInterface.
This adds method and tests for writing to a PDB stream. With this, even a PDB stream which is discontiguous can be treated as a sequential stream of bytes for the purposes of writing. Reviewed By: ruiu Differential Revision: http://reviews.llvm.org/D21157 llvm-svn: 272369
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
index 086105b..7426dae 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
@@ -136,6 +136,17 @@ ArrayRef<uint8_t> PDBFile::getBlockData(uint32_t BlockIndex,
NumBytes);
}
+Error PDBFile::setBlockData(uint32_t BlockIndex, uint32_t Offset,
+ ArrayRef<uint8_t> Data) const {
+ if (BlockIndex >= getBlockCount())
+ return make_error<RawError>(raw_error_code::invalid_block_address);
+
+ if (Offset > getBlockSize() - Data.size())
+ return make_error<RawError>(raw_error_code::insufficient_buffer);
+
+ return make_error<RawError>(raw_error_code::not_writable);
+}
+
Error PDBFile::parseFileHeaders() {
std::error_code EC;
MemoryBufferRef BufferRef = *Context->Buffer;