Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: include/llvm/Bitcode/NaCl/NaClReaderWriter.h

Issue 1310883003: Install notion of diagnostic handler into PNaCl bitcode readers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix issues in patch set 2. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h ('k') | include/llvm/IRReader/IRReader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
/// 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);
« no previous file with comments | « include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h ('k') | include/llvm/IRReader/IRReader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698