]> granicus.if.org Git - clang/commit
Bitcode: Change reader interface to take memory buffers.
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 2 Nov 2016 00:08:19 +0000 (00:08 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 2 Nov 2016 00:08:19 +0000 (00:08 +0000)
commit202d09ece44fd6b8dd1c15195920c4746bbce237
tree30d5007a04000da419e8d4ad9c1c83cbfbff147d
parent153d45226d1ee6f028089deb92f16f530fe6fb52
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285773 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/ObjectFilePCHContainerOperations.cpp
lib/Frontend/PCHContainerOperations.cpp
lib/Frontend/SerializedDiagnosticReader.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/GlobalModuleIndex.cpp