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 4b92e4767c21d501c6e4f966ff42cc341554ca3e..fa81fc2e9c17d7d5f7b06c02942ffd0c1dfd01a2 100644 |
| --- a/include/llvm/Bitcode/NaCl/NaClReaderWriter.h |
| +++ b/include/llvm/Bitcode/NaCl/NaClReaderWriter.h |
| @@ -17,6 +17,7 @@ |
| #define LLVM_BITCODE_NACL_NACLREADERWRITER_H |
| #include "llvm/Support/CommandLine.h" |
| +#include "llvm/Support/ErrorOr.h" |
| #include <string> |
| @@ -45,8 +46,10 @@ namespace llvm { |
| /// getNaClLazyBitcodeModule - 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 |
| - /// error, this returns null, *does not* take ownership of Buffer, and fills |
| - /// in *ErrMsg with an error description if ErrMsg is non-null. |
| + /// error, this returns an error code and *does not* take ownership of Buffer. |
| + /// |
| + /// When VerboseErrors is true, more descriptive error messages are also |
| + /// written to errs(). |
| /// |
| /// The AcceptSupportedOnly argument is used to decide which PNaCl versions |
| /// of the PNaCl bitcode to accept. There are three forms: |
| @@ -56,47 +59,43 @@ namespace llvm { |
| /// 3) Unreadable. |
| /// When AcceptSupportedOnly is true, only form 1 is allowed. When |
| /// AcceptSupportedOnly is false, forms 1 and 2 are allowed. |
| - Module *getNaClLazyBitcodeModule(MemoryBuffer *Buffer, |
| - LLVMContext &Context, |
| - std::string *ErrMsg = 0, |
| - bool AcceptSupportedOnly = true); |
| + ErrorOr<Module *> getNaClLazyBitcodeModule(MemoryBuffer *Buffer, |
| + LLVMContext &Context, |
| + bool VerboseErrors = false, |
| + bool AcceptSupportedOnly = true); |
| /// getNaClStreamedBitcodeModule - 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 argument |
| - /// AcceptSupportedOnly. |
| + /// See getNaClLazyBitcodeModule for an explanation of arguments |
| + /// VerboseErrors, AcceptSupportedOnly. |
| Module *getNaClStreamedBitcodeModule(const std::string &name, |
|
jvoung (off chromium)
2014/12/01 23:23:49
Interesting... Didn't realize that upstream this i
Karl
2014/12/03 18:32:09
I noticed it too. However, since it wasn't changed
|
| StreamingMemoryObject *streamer, |
| LLVMContext &Context, |
| + bool VerboseErrors = false, |
| std::string *ErrMsg = 0, |
|
jvoung (off chromium)
2014/12/01 23:23:49
nullptr
Karl
2014/12/03 18:32:09
Done.
|
| bool AcceptSupportedOnly = true); |
| /// NaClParseBitcodeFile - Read the specified bitcode file, |
| - /// returning the module. If an error occurs, this returns null and |
| - /// fills in *ErrMsg if it is non-null. This method *never* takes |
| - /// ownership of Buffer. |
| + /// returning the module. If an error_code if error occurs. This |
|
JF
2014/12/02 00:49:03
This line doesn't make sense.
Karl
2014/12/03 18:32:09
Cleaned this up.
|
| + /// method *never* takes ownership of Buffer. |
| /// |
| - /// See getNaClLazyBitcodeModule for an explanation of argument |
| - /// AcceptSupportedOnly. |
| - Module *NaClParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext &Context, |
| - std::string *ErrMsg = 0, |
| - bool AcceptSupportedOnly = true); |
| + /// See getNaClLazyBitcodeModule for an explanation of arguments |
| + /// VerboseErrors, AcceptSupportedOnly. |
| + ErrorOr<Module *> NaClParseBitcodeFile(MemoryBuffer *Buffer, |
| + LLVMContext &Context, |
| + bool VerboseErrors = false, |
| + bool AcceptSupportedOnly = true); |
| /// NaClWriteBitcodeToFile - Write the specified module to the |
| /// specified raw output stream, using PNaCl wire format. For |
| /// streams where it matters, the given stream should be in "binary" |
| /// mode. |
| /// |
| - /// The AcceptSupportedOnly argument is used to decide which PNaCl versions |
| - /// of the PNaCl bitcode to generate. There are two forms: |
| - /// 1) Writable and supported. |
| - /// 2) Writable and unsupported. Allows testing of code before becoming |
| - /// supported, as well as running experiments on the bitcode format. |
| - /// When AcceptSupportedOnly is true, only form 1 is allowed. When |
| - /// AcceptSupportedOnly is false, forms 1 and 2 are allowed. |
| + /// See getNaClLazyBitcodeModule for an explanation of arguments |
| + /// VerboseErrors, AcceptSupportedOnly. |
|
JF
2014/12/02 00:49:03
This method doesn't have a VerboseErrors argument.
Karl
2014/12/03 18:32:09
Good point. Incorrectly changed comment to write r
|
| void NaClWriteBitcodeToFile(const Module *M, raw_ostream &Out, |
| bool AcceptSupportedOnly = true); |