Chromium Code Reviews| Index: include/llvm/Bitcode/NaCl/NaClReaderWriter.h |
| diff --git a/include/llvm/Bitcode/NaCl/NaClReaderWriter.h b/include/llvm/Bitcode/NaCl/NaClReaderWriter.h |
| index 6ac74722b3ebc0fbadf3fa46b27969636e81d725..762e51b65f1c09d0e39922782e7d476d8d63ed79 100644 |
| --- a/include/llvm/Bitcode/NaCl/NaClReaderWriter.h |
| +++ b/include/llvm/Bitcode/NaCl/NaClReaderWriter.h |
| @@ -16,6 +16,7 @@ |
| #ifndef LLVM_BITCODE_NACL_NACLREADERWRITER_H |
| #define LLVM_BITCODE_NACL_NACLREADERWRITER_H |
| +#include "llvm/IR/DiagnosticInfo.h" |
| #include "llvm/Support/CommandLine.h" |
| #include "llvm/Support/ErrorOr.h" |
| #include "llvm/Support/MemoryBuffer.h" |
| @@ -43,13 +44,13 @@ namespace llvm { |
| /// \brief Defines the integer bit size used to model pointers in PNaCl. |
| static const unsigned PNaClIntPtrTypeBitSize = 32; |
| + /// Diagnostic handler that redirects error diagnostics to the given stream. |
| + DiagnosticHandlerFunction redirectNaClDiagnosticToStream(raw_ostream &Out); |
| + |
| /// Read the header of the specified bitcode buffer and prepare for lazy |
| /// deserialization of function bodies. If successful, this takes ownership |
| - /// of 'Buffer' (extending its lifetime). On error, this returns an error code |
| - /// and deletes Buffer. |
| - /// |
| - /// When Verbose is non-null, more descriptive error messages are also |
| - /// written to Verbose. |
| + /// of 'Buffer' (extending its lifetime). On error, this returns an error |
| + /// code and deletes Buffer. |
| /// |
| /// The AcceptSupportedOnly argument is used to decide which PNaCl versions |
| /// of the PNaCl bitcode to accept. There are three forms: |
| @@ -61,37 +62,37 @@ namespace llvm { |
| /// AcceptSupportedOnly is false, forms 1 and 2 are allowed. |
| ErrorOr<Module *> getNaClLazyBitcodeModule( |
| std::unique_ptr<MemoryBuffer> &&Buffer, LLVMContext &Context, |
| - raw_ostream *Verbose = nullptr, bool AcceptSupportedOnly = true); |
| + DiagnosticHandlerFunction DiagnosticHandler = nullptr, |
| + bool AcceptSupportedOnly = true); |
| /// 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. |
| /// |
| - /// See getNaClLazyBitcodeModule for an explanation of arguments |
| - /// Verbose, AcceptSupportedOnly. |
| + /// See getNaClLazyBitcodeModule for an explanation of argument |
| + /// AcceptSupportedOnly. |
| /// TODO(kschimpf): Refactor this and getStreamedBitcodeModule to use |
| /// ErrorOr<Module *> API so that all methods have the same interface. |
| - Module *getNaClStreamedBitcodeModule(const std::string &name, |
| - StreamingMemoryObject *streamer, |
| - LLVMContext &Context, |
| - raw_ostream *Verbose = nullptr, |
| - std::string *ErrMsg = nullptr, |
| - bool AcceptSupportedOnly = true); |
| + Module *getNaClStreamedBitcodeModule( |
| + const std::string &name, StreamingMemoryObject *streamer, |
| + LLVMContext &Context, |
| + DiagnosticHandlerFunction DiagnosticHandler = nullptr, |
| + std::string *ErrMsg = nullptr, bool AcceptSupportedOnly = true); |
|
Derek Schuff
2015/08/24 21:22:01
is ErrMsg used now that we have the diagnostic han
Karl
2015/08/24 22:23:18
I didn't clean this up in this patch. I removed th
|
| /// Read the bitcode file from a buffer, returning the module. |
| /// |
| - /// See getNaClLazyBitcodeModule for an explanation of arguments |
| - /// Verbose, AcceptSupportedOnly. |
| - ErrorOr<Module *> NaClParseBitcodeFile(MemoryBufferRef Buffer, |
| - LLVMContext &Context, |
| - raw_ostream *Verbose = nullptr, |
| - bool AcceptSupportedOnly = true); |
| + /// See getNaClLazyBitcodeModule for an explanation of argument |
| + /// AcceptSupportedOnly. |
| + ErrorOr<Module *> |
| + NaClParseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context, |
| + DiagnosticHandlerFunction DiagnosticHandler = nullptr, |
| + bool AcceptSupportedOnly = true); |
| /// Read the textual bitcode records in Filename, returning the module. |
| /// Note: If Filename is "-", stdin will be read. |
| /// |
| - /// See getNaClLazyBitcodeModule for an explanation of argument Verbose. |
| + /// TODO(kschimpf) Replace Verbose argument with a DiagnosticHandlerFunction. |
| ErrorOr<Module *> parseNaClBitcodeText(const std::string &Filename, |
| LLVMContext &Context, |
| raw_ostream *Verbose = nullptr); |