Index: include/llvm/Bitcode/ReaderWriter.h |
diff --git a/include/llvm/Bitcode/ReaderWriter.h b/include/llvm/Bitcode/ReaderWriter.h |
index fa754c014621f52af5698561d1718ae014f24bca..a7a63274fe6e90340093cfa65c4c78cbfd31e932 100644 |
--- a/include/llvm/Bitcode/ReaderWriter.h |
+++ b/include/llvm/Bitcode/ReaderWriter.h |
@@ -14,6 +14,7 @@ |
#ifndef LLVM_BITCODE_H |
#define LLVM_BITCODE_H |
+#include "llvm/Bitcode/BitcodeStream.h" |
#include <string> |
namespace llvm { |
@@ -23,7 +24,7 @@ namespace llvm { |
class BitstreamWriter; |
class LLVMContext; |
class raw_ostream; |
- |
+ |
/// getLazyBitcodeModule - Read the header of the specified bitcode buffer |
/// and prepare for lazy deserialization of function bodies. If successful, |
/// this takes ownership of 'buffer' and returns a non-null pointer. On |
@@ -33,6 +34,15 @@ namespace llvm { |
LLVMContext& Context, |
std::string *ErrMsg = 0); |
+ /// getStreamedBitcodeModule - Read the header of the specified stream |
+ /// and prepare for lazy deserialization and streaming of function bodies. |
+ /// On error, this returns null, and fills |
+ /// in *ErrMsg with an error description if ErrMsg is non-null. |
nlewycky
2011/11/05 00:45:06
Reflow text.
(google.com) Derek Schuff
2011/11/07 22:33:50
Done.
|
+ Module *getStreamedBitcodeModule(const std::string &name, |
+ BitcodeStreamer* streamer, |
nlewycky
2011/11/05 00:45:06
Fix indent.
(google.com) Derek Schuff
2011/11/07 22:33:50
Done.
|
+ LLVMContext& Context, |
+ std::string *ErrMsg = 0); |
+ |
/// getBitcodeTargetTriple - Read the header of the specified bitcode |
/// buffer and extract just the triple information. If successful, |
/// this returns a string and *does not* take ownership |
@@ -113,8 +123,10 @@ namespace llvm { |
/// This function is called when we find a file with a matching magic number. |
/// In this case, skip down to the subsection of the file that is actually a |
/// BC file. |
- static inline bool SkipBitcodeWrapperHeader(unsigned char *&BufPtr, |
- unsigned char *&BufEnd) { |
+ /// If 'verify' is true, check that the file fits in the buffer. |
nlewycky
2011/11/05 00:45:06
How does the caller tell whether we returned succe
(google.com) Derek Schuff
2011/11/07 22:33:50
I'm not sure I understand the question.
Before it
|
+ static inline bool SkipBitcodeWrapperHeader(const unsigned char *&BufPtr, |
+ const unsigned char *&BufEnd, |
+ bool Verify) { |
enum { |
KnownHeaderSize = 4*4, // Size of header we read. |
OffsetField = 2*4, // Offset in bytes to Offset field. |
@@ -134,7 +146,7 @@ namespace llvm { |
(BufPtr[SizeField +3] << 24)); |
// Verify that Offset+Size fits in the file. |
- if (Offset+Size > unsigned(BufEnd-BufPtr)) |
+ if (Verify && Offset+Size > unsigned(BufEnd-BufPtr)) |
return true; |
BufPtr += Offset; |
BufEnd = BufPtr+Size; |