aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/PCHContainerOperations.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-11-02 00:08:19 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-11-02 00:08:19 +0000
commit028eb5a3f823c25e6c3040d300910e23ed69e788 (patch)
tree9d3065523337ebcf7489b238e95435c17c14a273 /clang/lib/Frontend/PCHContainerOperations.cpp
parentce898dbb8135f1bd6b9b94c851bc0f8e99b72330 (diff)
downloadllvm-028eb5a3f823c25e6c3040d300910e23ed69e788.zip
llvm-028eb5a3f823c25e6c3040d300910e23ed69e788.tar.gz
llvm-028eb5a3f823c25e6c3040d300910e23ed69e788.tar.bz2
Bitcode: Change reader interface to take memory buffers.
As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106595.html This change also fixes an API oddity where BitstreamCursor::Read() would return zero for the first read past the end of the bitstream, but would report_fatal_error for subsequent reads. Now we always report_fatal_error for all reads past the end. Updated clients to check for the end of the bitstream before reading from it. I also needed to add padding to the invalid bitcode tests in test/Bitcode/. This is because the streaming interface was not checking that the file size is a multiple of 4. Differential Revision: https://reviews.llvm.org/D26219 llvm-svn: 285773
Diffstat (limited to 'clang/lib/Frontend/PCHContainerOperations.cpp')
-rw-r--r--clang/lib/Frontend/PCHContainerOperations.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Frontend/PCHContainerOperations.cpp b/clang/lib/Frontend/PCHContainerOperations.cpp
index 2d4edde..2c867e7 100644
--- a/clang/lib/Frontend/PCHContainerOperations.cpp
+++ b/clang/lib/Frontend/PCHContainerOperations.cpp
@@ -60,8 +60,7 @@ std::unique_ptr<ASTConsumer> RawPCHContainerWriter::CreatePCHContainerGenerator(
void RawPCHContainerReader::ExtractPCH(
llvm::MemoryBufferRef Buffer, llvm::BitstreamReader &StreamFile) const {
- StreamFile.init((const unsigned char *)Buffer.getBufferStart(),
- (const unsigned char *)Buffer.getBufferEnd());
+ StreamFile = llvm::BitstreamReader(Buffer);
}
PCHContainerOperations::PCHContainerOperations() {